Skip to content

Commit

Permalink
Update CORSMiddleware.swift (#237)
Browse files Browse the repository at this point in the history
  • Loading branch information
beldis authored Sep 18, 2023
1 parent 4ad3198 commit dbb9695
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions Sources/Hummingbird/Middleware/CORSMiddleware.swift
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,9 @@ public struct HBCORSMiddleware: HBMiddleware {
return next.respond(to: request).map { response in
var response = response
response.headers.add(name: "access-control-allow-origin", value: self.allowOrigin.value(for: request) ?? "")
if self.allowCredentials {
response.headers.add(name: "access-control-allow-credentials", value: "true")
}
if case .originBased = self.allowOrigin {
response.headers.add(name: "vary", value: "Origin")
}
Expand Down

0 comments on commit dbb9695

Please sign in to comment.