CORSMiddleware
Middleware that adds support for CORS settings in request responses. For configuration of this middleware please use the CORSMiddleware.Configuration
object.
final class CORSMiddleware
Middleware that adds support for CORS settings in request responses. For configuration of this middleware please use the CORSMiddleware.Configuration
object.
final class CORSMiddleware
import Vapor
Vapor is a framework for building server applications, APIs and websites in Swift. It provides a safe, performant and scalable foundation for building large complex backends.
@preconcurrency protocol Middleware : Sendable
Middleware
is placed between the server and your router. It is capable of mutating both incoming requests and outgoing responses. Middleware
can choose to pass requests on to the next Middleware
in a chain, or they can short circuit and return a custom Response
if desired.
protocol Sendable
init(configuration: Configuration = .default())
Creates a CORS middleware with the specified configuration.
let configuration: Configuration
Configuration used for populating headers in response for CORS requests.
func respond(to request: Request, chainingTo next: Responder) -> EventLoopFuture<Response>
enum AllowOriginSetting
Option for the allow origin header in responses for CORS requests.
struct Configuration
Configuration used for populating headers in response for CORS requests.
func makeResponder(chainingTo responder: Responder) -> Responder
Wraps a Responder
in a single Middleware
creating a new Responder
.