Skip to content

Commit

Permalink
nginx.conf: document dev-specific hacks (getodk#622)
Browse files Browse the repository at this point in the history
Co-authored-by: alxndrsn <alxndrsn>
  • Loading branch information
alxndrsn authored Aug 30, 2022
1 parent b7ca5dc commit f89993e
Showing 1 changed file with 17 additions and 4 deletions.
21 changes: 17 additions & 4 deletions main.nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -73,14 +73,27 @@ http {
proxy_pass http://localhost:8383;
proxy_redirect off;

include ./common-headers.nginx.conf;
add_header Set-Cookie $session_cookie;
proxy_set_header X-Forwarded-Proto https;

# buffer requests, but not responses, so streaming out works.
proxy_request_buffering on;
proxy_buffering off;
proxy_read_timeout 2m;

# Dev-specific hacks:

# In conjunction with the map{} definition above, remap
# "Set-Cookie: __Host-session=..." to "Set-Cookie: session=..."
#
# 1. Cookies cannot use the "__Host-" prefix in non-HTTPs requests
# see: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie#cookie_prefixes
# 2. central-backend cookie parsing is relaxed and will consider the
# first cookie ending in "session" to be the session cookie
add_header Set-Cookie $session_cookie;
# re-add common headers after add_header call
include ./common-headers.nginx.conf;

# Trick central-backend from thinking connections are coming
# over HTTPS so that ExpressJS will set "secure" cookies.
proxy_set_header X-Forwarded-Proto https;
}

location / {
Expand Down

0 comments on commit f89993e

Please sign in to comment.