http_request action working nicely
This commit is contained in:
@@ -26,9 +26,18 @@ server {
|
||||
add_header Content-Type text/plain;
|
||||
}
|
||||
|
||||
# Use Docker's embedded DNS resolver so that proxy_pass with variables
|
||||
# resolves hostnames at request time, not config load time.
|
||||
# This prevents nginx from crashing if backends aren't ready yet.
|
||||
resolver 127.0.0.11 valid=10s;
|
||||
set $api_upstream http://api:8080;
|
||||
set $notifier_upstream http://notifier:8081;
|
||||
|
||||
# Auth proxy - forward auth requests to backend
|
||||
# With variable proxy_pass (no URI path), the full original request URI
|
||||
# (e.g. /auth/login) is passed through to the backend as-is.
|
||||
location /auth/ {
|
||||
proxy_pass http://api:8080/auth/;
|
||||
proxy_pass $api_upstream;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection 'upgrade';
|
||||
@@ -45,8 +54,10 @@ server {
|
||||
}
|
||||
|
||||
# API proxy - forward API requests to backend (preserves /api prefix)
|
||||
# With variable proxy_pass (no URI path), the full original request URI
|
||||
# (e.g. /api/packs?page=1) is passed through to the backend as-is.
|
||||
location /api/ {
|
||||
proxy_pass http://api:8080/api/;
|
||||
proxy_pass $api_upstream;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection 'upgrade';
|
||||
@@ -63,8 +74,11 @@ server {
|
||||
}
|
||||
|
||||
# WebSocket proxy for notifier service
|
||||
# Strip the /ws/ prefix before proxying (notifier expects paths at root).
|
||||
# e.g. /ws/events → /events
|
||||
location /ws/ {
|
||||
proxy_pass http://notifier:8081/;
|
||||
rewrite ^/ws/(.*) /$1 break;
|
||||
proxy_pass $notifier_upstream;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection "Upgrade";
|
||||
|
||||
Reference in New Issue
Block a user