class CORSFilter extends EssentialFilter with AbstractCORSPolicy
A play.api.mvc.Filter that implements Cross-Origin Resource Sharing (CORS)
It can be configured to...
- filter paths by a whitelist of path prefixes
- allow only requests with origins from a whitelist (by default all origins are allowed) -
- allow only HTTP methods from a whitelist for preflight requests (by default all methods are allowed)
- allow only HTTP headers from a whitelist for preflight requests (by default all headers are allowed)
- set custom HTTP headers to be exposed in the response (by default no headers are exposed)
- disable/enable support for credentials (by default credentials support is enabled)
- set how long (in seconds) the results of a preflight request can be cached in a preflight result cache (by default 3600 seconds, 1 hour)
- enable/disable serving requests with origins not in whitelist as non-CORS requests (by default they are forbidden)
- Source
- CORSFilter.scala
- See also
play.filters.cors.AbstractCORSPolicy
Linear Supertypes
Ordering
- Alphabetic
- By Inheritance
Inherited
- CORSFilter
- AbstractCORSPolicy
- EssentialFilter
- AnyRef
- Any
- Hide All
- Show All
Visibility
- Public
- All
Instance Constructors
- new CORSFilter(corsConfig: CORSConfig, errorHandler: HttpErrorHandler, pathPrefixes: List[String])
-
new
CORSFilter(corsConfig: CORSConfig = CORSConfig(), errorHandler: HttpErrorHandler = DefaultHttpErrorHandler, pathPrefixes: Seq[String] = Seq("/"))
- corsConfig
configuration of the CORS policy
- pathPrefixes
whitelist of path prefixes to restrict the filter
-
new
CORSFilter(corsConfig: CORSConfig, errorHandler: HttpErrorHandler, pathPrefixes: List[String], contextComponents: JavaContextComponents)
- Annotations
- @deprecated
- Deprecated
(Since version 2.8.0) Use constructor without JavaContextComponents
Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
##(): Int
- Definition Classes
- AnyRef → Any
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
apply(next: EssentialAction): EssentialAction
- Definition Classes
- CORSFilter → EssentialFilter
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
def
asJava: EssentialFilter
- Definition Classes
- EssentialFilter
-
def
clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @native()
-
val
corsConfig: CORSConfig
- Attributes
- protected
- Definition Classes
- CORSFilter → AbstractCORSPolicy
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
val
errorHandler: HttpErrorHandler
- Attributes
- protected
- Definition Classes
- CORSFilter → AbstractCORSPolicy
-
def
filterRequest(next: EssentialAction, request: RequestHeader): Accumulator[ByteString, Result]
- Attributes
- protected
- Definition Classes
- AbstractCORSPolicy
-
def
finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] )
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
def
hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
val
logger: api.Logger
- Attributes
- protected
- Definition Classes
- CORSFilter → AbstractCORSPolicy
-
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
def
toString(): String
- Definition Classes
- AnyRef → Any
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @native()