Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove cors/csrf java code configuration, in favor of regular spring-cloud-gateway configuration #59

Merged
merged 3 commits into from
Nov 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,6 @@ public SecurityWebFilterChain securityWebFilterChain(ServerHttpSecurity http,
List<ServerHttpSecurityCustomizer> customizers) throws Exception {

log.info("Initializing security filter chain...");
// disable csrf and cors or the websocket connection gets a 403 Forbidden.
// Revisit.
log.info("CSRF and CORS disabled. Revisit how they interfer with Websockets proxying.");
http.csrf().disable().cors().disable();

http.formLogin()
.authenticationFailureHandler(new ExtendedRedirectServerAuthenticationFailureHandler("login?error"))
Expand Down
15 changes: 13 additions & 2 deletions gateway/src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ server:
port: 8080
compression.enabled: true
# HTTP/2 is only supported over TLS (HTTPS)
# So we need to configure SSL if we want to support HTTP/2
# So we need to configure SSL if we want to support HTTP/2
http2.enabled: ${server.ssl.enabled}
ssl:
enabled: false
#TODO: configure SSL with a self-signed certificate

spring:
config:
import: optional:file:${georchestra.datadir}/default.properties,optional:file:${georchestra.datadir}/gateway/gateway.yaml,optional:file:${georchestra.datadir}/gateway/security.yaml
Expand All @@ -32,6 +32,17 @@ spring:
enabled: true
global-filter.websocket-routing.enabled: true
metrics.enabled: true
# Uncomment the following to allow cross-origin requests from any methods
# coming from anywhere.
# See https://docs.spring.io/spring-cloud-gateway/reference/spring-cloud-gateway/cors-configuration.html
# for more infos.
#globalcors:
# cors-configurations:
# '[/**]':
# allowedOrigins: "*"
# allowedHeaders: "*"
# allowedMethods: "*"

default-filters:
- SecureHeaders
- TokenRelay
Expand Down
Loading