-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix swagger-ui behind a reverse proxy
Despite spring-doc documentation on how to set up the swagger-ui behind a reverse proxy, the X-Forwarded-Prefix request header is not honored. Fix by tweaking `SpringDocAutoConfiguration` to apply the prefix as appropriate.
- Loading branch information
Showing
17 changed files
with
433 additions
and
137 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
COMPOSE_PROJECT_NAME=acldev | ||
TAG=2.1-SNAPSHOT | ||
GATEWAY_TAG=1.7.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
cert.pem | ||
key.pem |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
version: "3.8" | ||
|
||
volumes: | ||
acl_data: | ||
|
||
services: | ||
acldb: | ||
image: postgis/postgis:15-3.3 | ||
environment: | ||
- POSTGRES_DB=acl | ||
- POSTGRES_USER=acl | ||
- POSTGRES_PASSWORD=acls3cr3t | ||
volumes: | ||
- acl_data:/var/lib/postgresql/data | ||
restart: always | ||
ports: | ||
- 6432:5432 | ||
healthcheck: | ||
test: ["CMD-SHELL", "pg_isready -U acl"] | ||
interval: 5s | ||
timeout: 5s | ||
retries: 5 | ||
deploy: | ||
resources: | ||
limits: | ||
cpus: '4.0' | ||
memory: 2G | ||
|
||
acl: | ||
image: geoservercloud/geoserver-acl:${TAG} | ||
environment: | ||
- PG_HOST=acldb | ||
- PG_PORT=5432 | ||
- PG_DB=acl | ||
- PG_SCHEMA=acl | ||
- PG_USER=acl | ||
- PG_PASSWORD=acls3cr3t | ||
- SPRING_PROFILES_ACTIVE=logging_debug_requests | ||
depends_on: | ||
acldb: | ||
condition: service_healthy | ||
required: true | ||
ports: | ||
- 8080:8080 | ||
- 8081:8081 | ||
deploy: | ||
resources: | ||
limits: | ||
cpus: '4.0' | ||
memory: 2G | ||
|
||
gateway: | ||
image: geoservercloud/geoserver-cloud-gateway:${GATEWAY_TAG} | ||
user: 1000:1000 | ||
environment: | ||
SPRING_PROFILES_ACTIVE: standalone | ||
GEOSERVER_BASE_PATH: /geoserver/cloud | ||
volumes: | ||
- ./gateway-service.yml:/etc/geoserver/gateway-service.yml | ||
ports: | ||
- 9090:8080 | ||
deploy: | ||
resources: | ||
limits: | ||
cpus: '4.0' | ||
memory: 1G | ||
|
||
nginx: | ||
image: nginx | ||
volumes: | ||
- ./nginx.conf:/etc/nginx/conf.d/default.conf | ||
- ./key.pem:/root/ssl/key.pem | ||
- ./cert.pem:/root/ssl/cert.pem | ||
ports: | ||
- "443:443" | ||
depends_on: | ||
- gateway |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
geoserver.base-path: ${geoserver_base_path:} | ||
|
||
targets.acl: http://10.0.0.71:8080 | ||
|
||
server: | ||
forward-headers-strategy: framework | ||
|
||
spring: | ||
cloud: | ||
gateway: | ||
x-forwarded: | ||
for-enabled: true | ||
host-enabled: true | ||
port-enabled: true | ||
proto-enabled: true | ||
prefix-enabled: true | ||
globalcors: | ||
cors-configurations: | ||
"[/**]": | ||
allowedOrigins: "*" | ||
allowedHeaders: "*" | ||
allowedMethods: GET, PUT, POST, DELETE, OPTIONS, HEAD | ||
default-filters: | ||
- StripBasePath=${geoserver.base-path} #remove the base path on downstream requests | ||
routes: | ||
- id: acl | ||
uri: ${targets.acl} | ||
predicates: | ||
- Path=${geoserver.base-path}/acl,${geoserver.base-path}/acl/** | ||
filters: | ||
- RewritePath=/acl,/acl/ | ||
--- | ||
spring.config.activate.on-profile: debug | ||
logging.level.root: debug | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
server { | ||
listen 443 ssl; | ||
listen [::]:443 ssl; | ||
server_name localhost; | ||
ssl_certificate /root/ssl/cert.pem; | ||
ssl_certificate_key /root/ssl/key.pem; | ||
|
||
location / { | ||
proxy_pass "http://gateway:8080/"; | ||
proxy_http_version 1.1; | ||
proxy_set_header Upgrade $http_upgrade; | ||
proxy_set_header Connection "upgrade"; | ||
proxy_set_header Host $host; | ||
proxy_set_header X-Forwarded-Proto https; | ||
} | ||
|
||
error_page 500 502 503 504 /50x.html; | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#!/bin/sh | ||
|
||
# generate a certificate to mount on the nginx container | ||
openssl req -x509 -nodes -newkey rsa:2048 -keyout key.pem -out cert.pem -sha256 -days 365 \ | ||
-subj "/C=GB/ST=London/L=London/O=Alros/OU=IT Department/CN=localhost" | ||
|
||
|
||
docker compose up |
Oops, something went wrong.