Skip to content

Commit

Permalink
add x-forwarded-* headers for messenger traffic
Browse files Browse the repository at this point in the history
  • Loading branch information
fcoelho committed Aug 7, 2024
1 parent 5369ced commit 53455aa
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions etc/nginx/conf.d/deskpro_server_params
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,24 @@ location ^~ /sys/services/messenger-api/ {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host;

{{if getenv "HTTP_USER_REAL_PROTO_HEADER"}}
proxy_set_header X-Forwarded-Proto $http_{{ (getenv "HTTP_USER_REAL_PROTO_HEADER") | toLower | replaceAll "-" "_" }} if_not_empty;
{{else}}
proxy_set_header X-Forwarded-Proto $proto_for_scheme;
{{end}}

{{if getenv "HTTP_USER_REAL_HOST_HEADER"}}
proxy_set_header X-Forwaded-Host $http_{{ (getenv "HTTP_USER_REAL_HOST_HEADER") | toLower | replaceAll "-" "_" }} if_not_empty;
{{else if getenv "HTTP_SERVE_HOST"}}
proxy_set_header X-Forwarded-Host "{{ getenv "HTTP_SERVE_HOST" "$http_host" }}";
{{end}}

{{if getenv "HTTP_USER_REAL_PORT_HEADER"}}
proxy_set_header X-Forwarded-Port $http_{{ (getenv "HTTP_USER_REAL_PORT_HEADER") | toLower | replaceAll "-" "_" }} if_not_empty;
{{else}}
proxy_set_header X-Forwarded-Port $port_for_scheme;
{{end}}

proxy_pass http://127.0.0.1:24000/;
proxy_redirect / /sys/services/messenger-api/;

Expand Down

0 comments on commit 53455aa

Please sign in to comment.