Skip to content

Commit

Permalink
Pass through the full request_uri to these proxied services
Browse files Browse the repository at this point in the history
It turns out that when proxy_pass is given a value with variables
in then it always proxies to exactly that value, without any of
the normal appending of the rest of the path or query. This means
we need to explicitly pass the request uri through in such cases.

Exactly what this means for processing of the content returned
from the proxied host is somewhat unclear, however testing of the
code-submitter suggests at least that its redirects work as desired.
  • Loading branch information
PeterJCLaw committed Feb 15, 2024
1 parent c8cb606 commit a18a613
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions roles/srobo-nginx/templates/nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ http {
# Use a variable to trick it into connecting lazily and thus always
# starting up, even if in a degraded mode.
set $competitorsvcs '{{ competitor_services_proxy_hostname }}';
proxy_pass https://$competitorsvcs/code-submitter/;
proxy_pass https://$competitorsvcs$request_uri;
# Note: don't set a Host header as we want the code-submitter to use our
# public hostname, not the hostname of the underlying machine.
}
Expand All @@ -134,7 +134,7 @@ http {
# Use a variable to trick it into connecting lazily and thus always
# starting up, even if in a degraded mode.
set $srcomp '{{ srcomp_proxy_hostname }}';
proxy_pass https://$srcomp/comp-api/;
proxy_pass https://$srcomp$request_uri;
}

# During the competition we un-comment this block to override the homepage
Expand Down

0 comments on commit a18a613

Please sign in to comment.