CORSConfig

sttp.tapir.server.interceptor.cors.CORSConfig
See theCORSConfig companion object
case class CORSConfig(allowedOrigin: AllowedOrigin, allowedCredentials: AllowedCredentials, allowedMethods: AllowedMethods, allowedHeaders: AllowedHeaders, exposedHeaders: ExposedHeaders, maxAge: MaxAge, preflightResponseStatusCode: StatusCode)

Attributes

Companion:
object
Graph
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any

Members list

Concise view

Value members

Concrete methods

Allows CORS requests with any headers.

Allows CORS requests with any headers.

Sets the Access-Control-Allow-Headers response header to *

Attributes

Allows CORS requests using any method.

Allows CORS requests using any method.

Sets the Access-Control-Allow-Methods response header to *

Attributes

Allows CORS requests from any origin.

Allows CORS requests from any origin.

Sets the Access-Control-Allow-Origin response header to *.

Attributes

Allows credentialed requests by setting the Access-Control-Allow-Credentials response header to true

Allows credentialed requests by setting the Access-Control-Allow-Credentials response header to true

Attributes

def allowHeaders(headerNames: String*): CORSConfig

Allows CORS requests using specific headers.

Allows CORS requests using specific headers.

If the preflight request's Access-Control-Request-Headers header requests one of the specified headers, the Access-Control-Allow-Headers response header is set to a comma-separated list of the given headers. Otherwise the Access-Control-Allow-Headers response header is suppressed.

Attributes

def allowMatchingOrigins(predicate: String => Boolean): CORSConfig

Allows CORS requests from origins matching predicate

Allows CORS requests from origins matching predicate

If the request Origin header matches the given predicate, sets the Access-Control-Allow-Origin response header to the given origin. Otherwise the Access-Control-Allow-Origin response header is suppressed.

Attributes

def allowMethods(methods: Method*): CORSConfig

Allows CORS requests using specific methods.

Allows CORS requests using specific methods.

If the preflight request's Access-Control-Request-Method header requests one of the specified methods, the Access-Control-Allow-Methods response header is set to a comma-separated list of the given methods. Otherwise the Access-Control-Allow-Methods response header is suppressed.

Attributes

def allowOrigin(origin: Origin): CORSConfig

Allows CORS requests only from a specific origin.

Allows CORS requests only from a specific origin.

If the request Origin matches the given origin, sets the Access-Control-Allow-Origin response header to the given origin. Otherwise the Access-Control-Allow-Origin response header is suppressed.

Attributes

Determines how long the response to a preflight request can be cached by the client.

Determines how long the response to a preflight request can be cached by the client.

Suppresses the Access-Control-Max-Age response header, which makes the client use its default value.

Attributes

Sets the response status code of successful preflight requests to "204 No Content"

Sets the response status code of successful preflight requests to "204 No Content"

Attributes

Blocks credentialed requests by suppressing the Access-Control-Allow-Credentials response header

Blocks credentialed requests by suppressing the Access-Control-Allow-Credentials response header

Attributes

Exposes all response headers to JavaScript in browsers

Exposes all response headers to JavaScript in browsers

Sets the Access-Control-Expose-Headers response header to *

Attributes

def exposeHeaders(headerNames: String*): CORSConfig

Exposes specific response headers to JavaScript in browsers

Exposes specific response headers to JavaScript in browsers

Sets the Access-Control-Expose-Headers response header to a comma-separated list of the given headerNames

Attributes

Exposes no response headers to JavaScript in browsers

Exposes no response headers to JavaScript in browsers

Suppresses the Access-Control-Expose-Headers response header

Attributes

def maxAge(duration: Duration): CORSConfig

Determines how long the response to a preflight request can be cached by the client.

Determines how long the response to a preflight request can be cached by the client.

Sets the Access-Control-Max-Age response header to the given duration in seconds.

Attributes

def preflightResponseStatusCode(statusCode: StatusCode): CORSConfig

Sets the response status code of successful preflight requests to the given statusCode

Sets the response status code of successful preflight requests to the given statusCode

Attributes

Allows CORS requests using any headers requested in preflight request's Access-Control-Request-Headers header.

Allows CORS requests using any headers requested in preflight request's Access-Control-Request-Headers header.

Use reflectHeaders instead of allowAllHeaders when credentialed requests are enabled with allowCredentials, since wildcards are illegal when credentials are enabled

Attributes

Inherited methods

def productElementNames: Iterator[String]

Attributes

Inherited from:
Product
def productIterator: Iterator[Any]

Attributes

Inherited from:
Product