rerouting api

This commit is contained in:
2025-11-22 11:28:56 +00:00
parent 741723246c
commit 491c591c3c

View File

@@ -57,12 +57,13 @@ http {
root /var/www/certbot; root /var/www/certbot;
} }
location = /posts { location = /api {
return 301 /posts/; return 301 /api/;
} }
location /posts/ { location /api/ {
proxy_pass http://$BACKEND_HOST:$BACKEND_PORT/posts; rewrite ^/api/(.*)$ /$1 break;
proxy_pass http://$BACKEND_HOST:$BACKEND_PORT;
proxy_set_header Host $host; proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;