Cors

wvlet.airframe.http.filter.Cors
object Cors

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
Self type
Cors.type

Members list

Type members

Classlikes

case class Policy(allowsOrigin: String => Option[String], allowsMethods: String => Option[Seq[String]], allowsHeaders: Seq[String] => Option[Seq[String]], exposedHeaders: Seq[String], supportsCredentials: Boolean, maxAge: Option[Duration])

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Value members

Concrete methods

def newFilter(policy: Policy): RxHttpFilter

Create a new RxHttpFilter to add headers to support Cross-origin resource sharing (CORS).

Create a new RxHttpFilter to add headers to support Cross-origin resource sharing (CORS).

 Cors.newFilter(
   Cors.Policy(
     allowsOrigin = origin => { origin match {
       case x if x.endsWith("mydomain.com") => Some(origin)
       case _ => None
     }},
     allowsMethods = _ => Some(Seq(HttpMethod.POST)),
     allowsHeaders = headers => Some(headers)
  ))

Attributes

A CORS policy that lets you do whatever you want. Don't use this in production.

A CORS policy that lets you do whatever you want. Don't use this in production.

Attributes