Skip to content

Commit

Permalink
Merge pull request #54 from deskpro/add-x-headers-for-messenger
Browse files Browse the repository at this point in the history
add x-forwarded-* headers for messenger traffic
  • Loading branch information
fcoelho authored Aug 8, 2024
2 parents 557cc86 + 5ee8a44 commit 7a2954b
Showing 1 changed file with 18 additions and 0 deletions.
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 7a2954b

Please sign in to comment.