Skip to content

Commit

Permalink
Make proxy params a variable
Browse files Browse the repository at this point in the history
  • Loading branch information
dtcooper committed Aug 15, 2024
1 parent 04f7cf2 commit c4947da
Showing 1 changed file with 10 additions and 12 deletions.
22 changes: 10 additions & 12 deletions server/nginx/image/etc/nginx/templates/app.conf.j2
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
{%- set PROXY_PARAMS %}
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
{%- endset %}

map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
Expand Down Expand Up @@ -31,31 +38,22 @@ server {

location /_internal/server_logs {
internal;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_buffering off;
proxy_cache off;
{{ PROXY_PARAMS }}
proxy_pass http://logs:8000/server_logs;
}

location = /api {
proxy_http_version 1.1;
proxy_set_header Connection $connection_upgrade;
proxy_set_header Host $http_host;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Real-IP $remote_addr;
{{ PROXY_PARAMS }}
proxy_pass http://api:8000;
}

location / {
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
{{ PROXY_PARAMS }}
proxy_pass http://app:8000;
}
}

0 comments on commit c4947da

Please sign in to comment.