Skip to content

Commit

Permalink
Tweak the headers for the options requests
Browse files Browse the repository at this point in the history
  • Loading branch information
MattGrundy committed Sep 13, 2024
1 parent 297861f commit 59262da
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions etc/nginx/conf.d/deskpro_server_params.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -46,22 +46,26 @@ location ^~ /api/ {
}

location ^~ /sys/services/messenger-api/ {
add_header 'Access-Control-Allow-Origin' '*';
add_header 'Access-Control-Allow-Headers' '*';
add_header 'Access-Control-Max-Age' '1728000';
if ($request_method = 'OPTIONS') {
add_header 'Access-Control-Allow-Origin' '*';
add_header 'Access-Control-Allow-Headers' '*';
add_header 'Access-Control-Max-Age' '1728000';
add_header 'Content-Type' 'text/plain charset=UTF-8';
add_header 'Content-Length' 0;
return 204;
}

add_header 'Access-Control-Allow-Origin' '*';
add_header 'Access-Control-Allow-Headers' '*';
add_header 'Access-Control-Max-Age' '1728000';

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 "-" "_" }};
proxy_set_header X-Forwarded-Proto $http_{{ (getenv "HTTP_USER_REAL_PROTO_HEADER") | toLower | replaceAll "-" "_" }};
{{else}}
proxy_set_header X-Forwarded-Proto $proto_for_scheme;
proxy_set_header X-Forwarded-Proto $proto_for_scheme;
{{end}}

{{if getenv "HTTP_USER_REAL_HOST_HEADER"}}
Expand Down

0 comments on commit 59262da

Please sign in to comment.