Packages

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.CORSConfig

play.filters.cors.AbstractCORSPolicy

play.filters.cors.CORSActionBuilder

CORS specification

Linear Supertypes
AbstractCORSPolicy, EssentialFilter, AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. CORSFilter
  2. AbstractCORSPolicy
  3. EssentialFilter
  4. AnyRef
  5. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Instance Constructors

  1. new CORSFilter(corsConfig: CORSConfig, errorHandler: HttpErrorHandler, pathPrefixes: List[String])
  2. 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

  3. 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

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##: Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. def apply(next: EssentialAction): EssentialAction
    Definition Classes
    CORSFilterEssentialFilter
  5. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  6. def asJava: EssentialFilter
    Definition Classes
    EssentialFilter
  7. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.CloneNotSupportedException]) @HotSpotIntrinsicCandidate() @native()
  8. val corsConfig: CORSConfig
    Attributes
    protected
    Definition Classes
    CORSFilter → AbstractCORSPolicy
  9. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  10. def equals(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef → Any
  11. val errorHandler: HttpErrorHandler
    Attributes
    protected
    Definition Classes
    CORSFilter → AbstractCORSPolicy
  12. def filterRequest(next: EssentialAction, request: RequestHeader): Accumulator[ByteString, Result]
    Attributes
    protected
    Definition Classes
    AbstractCORSPolicy
  13. final def getClass(): Class[_ <: AnyRef]
    Definition Classes
    AnyRef → Any
    Annotations
    @HotSpotIntrinsicCandidate() @native()
  14. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @HotSpotIntrinsicCandidate() @native()
  15. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  16. val logger: LoggerLike
    Attributes
    protected
    Definition Classes
    CORSFilter → AbstractCORSPolicy
  17. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  18. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @HotSpotIntrinsicCandidate() @native()
  19. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @HotSpotIntrinsicCandidate() @native()
  20. final def synchronized[T0](arg0: => T0): T0
    Definition Classes
    AnyRef
  21. def toString(): String
    Definition Classes
    AnyRef → Any
  22. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  23. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException]) @native()
  24. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])

Deprecated Value Members

  1. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.Throwable]) @Deprecated
    Deprecated

    (Since version 9)

Inherited from AbstractCORSPolicy

Inherited from EssentialFilter

Inherited from AnyRef

Inherited from Any

Ungrouped