trait CorsSettings extends javadsl.settings.CorsSettings
Settings for the CORS support
This implementation is based on the akka-http-cors project by Lomig Mégard, licensed under the Apache License, Version 2.0.
Not for user extension
- Self Type
- CorsSettingsImpl
- Annotations
- @ApiMayChange() @DoNotInherit()
- Source
- CorsSettings.scala
- Alphabetic
- By Inheritance
- CorsSettings
- CorsSettings
- AnyRef
- Any
- by any2stringadd
- by StringFormat
- by Ensuring
- by ArrowAssoc
- Hide All
- Show All
- Public
- Protected
Abstract Value Members
- abstract def allowCredentials: Boolean
If enabled, the header
Access-Control-Allow-Credentials
is included in the response, indicating that the actual request can include user credentials.If enabled, the header
Access-Control-Allow-Credentials
is included in the response, indicating that the actual request can include user credentials. Examples of user credentials are: cookies, HTTP authentication or client-side certificates.- Definition Classes
- CorsSettings → CorsSettings
- abstract def allowGenericHttpRequests: Boolean
Allow generic requests, that are outside the scope of the specification, for example lacking an
Origin
header to pass through the directive.Allow generic requests, that are outside the scope of the specification, for example lacking an
Origin
header to pass through the directive.When false strict CORS filtering is applied and any invalid request will be rejected.
- Definition Classes
- CorsSettings → CorsSettings
- abstract def allowedHeaders: Set[String]
Set of request headers that are allowed when making an actual request.
Set of request headers that are allowed when making an actual request.
Controls the content of the
Access-Control-Allow-Headers
header in a preflight response: If set to a single*
, the headers fromAccess-Control-Request-Headers
are echoed. Otherwise specified list of header names is returned as part of the header. - abstract def allowedMethods: Set[HttpMethod]
List of methods allowed when making an actual request.
List of methods allowed when making an actual request. The listed headers are returned as part of the
Access-Control-Allow-Methods
preflight response header.The preflight request will be rejected if the
Access-Control-Request-Method
header's method is not part of the list. - abstract def allowedOrigins: Set[String]
List of origins that the CORS filter must allow.
List of origins that the CORS filter must allow.
Can also be set to a single
*
to allow access to the resource from any origin.Controls the content of the
Access-Control-Allow-Origin
response header: if parameter is*
and credentials are not allowed, a*
is returned inAccess-Control-Allow-Origin
. Otherwise, the origins given in theOrigin
request header are echoed.Hostname starting with
*.
will match any sub-domain. The scheme and the port are always strictly matched.The actual or preflight request is rejected if any of the origins from the request is not allowed.
- abstract def exposedHeaders: Set[String]
Set of headers (other than simple response headers) that browsers are allowed to access.
Set of headers (other than simple response headers) that browsers are allowed to access. If not empty, the listed headers are returned as part of the
Access-Control-Expose-Headers
header in responses. - abstract def maxAge: FiniteDuration
The time the browser is allowed to cache the results of a preflight request.
The time the browser is allowed to cache the results of a preflight request. This value is returned as part of the
Access-Control-Max-Age
preflight response header. Ifscala.concurrent.duration.Duration.Zero
, the header is not added to the preflight response.
Concrete Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##: Int
- Definition Classes
- AnyRef → Any
- def +(other: String): String
- Implicit
- This member is added by an implicit conversion from CorsSettings toany2stringadd[CorsSettings] performed by method any2stringadd in scala.Predef.
- Definition Classes
- any2stringadd
- def ->[B](y: B): (CorsSettings, B)
- Implicit
- This member is added by an implicit conversion from CorsSettings toArrowAssoc[CorsSettings] performed by method ArrowAssoc in scala.Predef.
- Definition Classes
- ArrowAssoc
- Annotations
- @inline()
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @HotSpotIntrinsicCandidate() @native()
- def ensuring(cond: (CorsSettings) => Boolean, msg: => Any): CorsSettings
- Implicit
- This member is added by an implicit conversion from CorsSettings toEnsuring[CorsSettings] performed by method Ensuring in scala.Predef.
- Definition Classes
- Ensuring
- def ensuring(cond: (CorsSettings) => Boolean): CorsSettings
- Implicit
- This member is added by an implicit conversion from CorsSettings toEnsuring[CorsSettings] performed by method Ensuring in scala.Predef.
- Definition Classes
- Ensuring
- def ensuring(cond: Boolean, msg: => Any): CorsSettings
- Implicit
- This member is added by an implicit conversion from CorsSettings toEnsuring[CorsSettings] performed by method Ensuring in scala.Predef.
- Definition Classes
- Ensuring
- def ensuring(cond: Boolean): CorsSettings
- Implicit
- This member is added by an implicit conversion from CorsSettings toEnsuring[CorsSettings] performed by method Ensuring in scala.Predef.
- Definition Classes
- Ensuring
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- def getAllowedHeaders: Set[String]
Set of request headers that are allowed when making an actual request.
Set of request headers that are allowed when making an actual request.
Controls the content of the
Access-Control-Allow-Headers
header in a preflight response: If set to a single*
, the headers fromAccess-Control-Request-Headers
are echoed. Otherwise specified list of header names is returned as part of the header.- Definition Classes
- CorsSettings
- def getAllowedMethods: Set[HttpMethod]
List of methods allowed when making an actual request.
List of methods allowed when making an actual request. The listed headers are returned as part of the
Access-Control-Allow-Methods
preflight response header.The preflight request will be rejected if the
Access-Control-Request-Method
header's method is not part of the list.- Definition Classes
- CorsSettings
- def getAllowedOrigins: Set[String]
List of origins that the CORS filter must allow.
List of origins that the CORS filter must allow.
Can also be set to a single
*
to allow access to the resource from any origin.Controls the content of the
Access-Control-Allow-Origin
response header: if parameter is*
and credentials are not allowed, a*
is returned inAccess-Control-Allow-Origin
. Otherwise, the origins given in theOrigin
request header are echoed.Hostname starting with
*.
will match any sub-domain. The scheme and the port are always strictly matched.The actual or preflight request is rejected if any of the origins from the request is not allowed.
- Definition Classes
- CorsSettings
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @HotSpotIntrinsicCandidate() @native()
- def getExposedHeaders: Set[String]
Set of headers (other than simple response headers) that browsers are allowed to access.
Set of headers (other than simple response headers) that browsers are allowed to access. If not empty, the listed headers are returned as part of the
Access-Control-Expose-Headers
header in responses.- Definition Classes
- CorsSettings
- def getMaxAge: Duration
The time the browser is allowed to cache the results of a preflight request.
The time the browser is allowed to cache the results of a preflight request. This value is returned as part of the
Access-Control-Max-Age
preflight response header. Ifjava.time.Duration.ZERO
, the header is not added to the preflight response.- Definition Classes
- CorsSettings
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @HotSpotIntrinsicCandidate() @native()
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @HotSpotIntrinsicCandidate() @native()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @HotSpotIntrinsicCandidate() @native()
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toString(): String
- Definition Classes
- AnyRef → Any
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- def withAllowAnyHeader(): CorsSettings
- Definition Classes
- CorsSettings → CorsSettings
- def withAllowAnyOrigin(): CorsSettings
- Definition Classes
- CorsSettings → CorsSettings
- def withAllowCredentials(allow: Boolean): CorsSettings
- Definition Classes
- CorsSettings → CorsSettings
- def withAllowGenericHttpRequests(allow: Boolean): CorsSettings
- Definition Classes
- CorsSettings → CorsSettings
- def withAllowedHeaders(headerNames: Set[String]): CorsSettings
- def withAllowedHeaders(headerNames: Set[String]): javadsl.settings.CorsSettings
- Definition Classes
- CorsSettings
- def withAllowedMethods(methods: Set[HttpMethod]): CorsSettings
- def withAllowedMethods(methods: Set[HttpMethod]): javadsl.settings.CorsSettings
- Definition Classes
- CorsSettings
- def withAllowedOrigins(origins: Set[String]): CorsSettings
- def withAllowedOrigins(origins: Set[String]): javadsl.settings.CorsSettings
- Definition Classes
- CorsSettings
- def withExposedHeaders(headerNames: Set[String]): CorsSettings
- def withExposedHeaders(headerNames: Set[String]): javadsl.settings.CorsSettings
- Definition Classes
- CorsSettings
- def withMaxAge(maxAge: FiniteDuration): CorsSettings
Deprecated Value Members
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable]) @Deprecated
- Deprecated
(Since version 9)
- def formatted(fmtstr: String): String
- Implicit
- This member is added by an implicit conversion from CorsSettings toStringFormat[CorsSettings] performed by method StringFormat in scala.Predef.
- Definition Classes
- StringFormat
- Annotations
- @deprecated @inline()
- Deprecated
(Since version 2.12.16) Use
formatString.format(value)
instead ofvalue.formatted(formatString)
, or use thef""
string interpolator. In Java 15 and later,formatted
resolves to the new method in String which has reversed parameters.
- def →[B](y: B): (CorsSettings, B)
- Implicit
- This member is added by an implicit conversion from CorsSettings toArrowAssoc[CorsSettings] performed by method ArrowAssoc in scala.Predef.
- Definition Classes
- ArrowAssoc
- Annotations
- @deprecated
- Deprecated
(Since version 2.13.0) Use
->
instead. If you still wish to display it as one character, consider using a font with programming ligatures such as Fira Code.