Skip to content
This repository has been archived by the owner on Apr 12, 2024. It is now read-only.

Commit

Permalink
fix(cors): Always let OPTIONS pass
Browse files Browse the repository at this point in the history
  • Loading branch information
tklein1801 committed Dec 12, 2023
1 parent d3aa503 commit 4983cdf
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import de.budgetbuddy.backend.user.UserRepository;
import lombok.AllArgsConstructor;
import lombok.Data;
import org.springframework.http.HttpMethod;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.util.AntPathMatcher;
Expand Down Expand Up @@ -49,7 +50,8 @@ public boolean preHandle(
Object handler) throws Exception {
PathMatcher pathMatcher = new AntPathMatcher();
String path = request.getRequestURI();
if (pathMatcher.match("/v1/auth/**", path)) {
if (pathMatcher.match("/v1/auth/**", path)
|| request.getMethod().equals(HttpMethod.OPTIONS.toString())) {
return true;
}

Expand Down

0 comments on commit 4983cdf

Please sign in to comment.