Skip to content

Commit

Permalink
Merge pull request quarkusio#45547 from gsmet/do-not-log-error-for-ch…
Browse files Browse the repository at this point in the history
…rome-extensions

DevUICORSFilter - Do not log errors for Chrome extensions
  • Loading branch information
geoand authored Jan 14, 2025
2 parents 90dd16b + 11a0eed commit 811996b
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ public class DevUICORSFilter implements Handler<RoutingContext> {
private static final String HTTPS_LOCAL_HOST = "https://" + LOCAL_HOST;
private static final String HTTP_LOCAL_HOST_IP = "http://" + LOCAL_HOST_IP;
private static final String HTTPS_LOCAL_HOST_IP = "https://" + LOCAL_HOST_IP;
private static final String CHROME_EXTENSION = "chrome-extension://";

public DevUICORSFilter() {
}
Expand Down Expand Up @@ -53,7 +54,9 @@ public void handle(RoutingContext event) {
|| origin.startsWith(HTTP_LOCAL_HOST_IP) || origin.startsWith(HTTPS_LOCAL_HOST_IP)) {
corsFilter().handle(event);
} else {
LOG.errorf("Only localhost origin is allowed, but Origin header value is: %s", origin);
if (!origin.startsWith(CHROME_EXTENSION)) {
LOG.errorf("Only localhost origin is allowed, but Origin header value is: %s", origin);
}
response.setStatusCode(403);
response.setStatusMessage("CORS Rejected - Invalid origin");
response.end();
Expand Down

0 comments on commit 811996b

Please sign in to comment.