Skip to content

Commit

Permalink
handle null origin in cors handler (#42)
Browse files Browse the repository at this point in the history
  • Loading branch information
bavardage authored Feb 23, 2022
1 parent 83f1142 commit 2dd00f9
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public record CorsHandler(Set<String> allowedOrigins, HttpHandler delegate) impl
@Override
public void handleRequest(HttpServerExchange exchange) throws Exception {
String origin = exchange.getRequestHeaders().getFirst(Headers.ORIGIN);
if (!allowedOrigins.contains(origin)) {
if (origin != null && !allowedOrigins.contains(origin)) {
exchange.setStatusCode(403)
.getResponseSender()
.send("Origin '" + origin + "' not allowed.");
Expand Down

0 comments on commit 2dd00f9

Please sign in to comment.