Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion nginx.conf.template
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,16 @@ server {
#- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Home page redirects...

rewrite ^/$ /creator/home permanent;
# Emit relative Location headers so redirects keep the port the client
# connected on. With absolute_redirect on (the default) nginx builds the
# Location from server_name and its internal listen port, which drops the
# published host port when they differ.
absolute_redirect off;

# 302 (redirect), not 301 (permanent), for the live entry point: browsers
# cache a 301 persistently, so a stale one (eg pointing at the wrong port)
# survives an image change and is painful to evict from every client.
rewrite ^/$ /creator/home redirect;
rewrite ^/dojo/index(.*) /creator/home permanent;


Expand Down
6 changes: 3 additions & 3 deletions test/test_image_starts.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@


def test_c7a2f101():
"""The production image starts and nginx redirects / to /creator/home."""
"""The production image starts and nginx 302-redirects / to the relative /creator/home."""
r = requests.get(f"{_BASE_URL}/", timeout=2, allow_redirects=False)
assert r.status_code == 301
assert r.headers["Location"].endswith("/creator/home")
assert r.status_code == 302, f"expected 302, got {r.status_code}"
assert r.headers["Location"] == "/creator/home", f"Location={r.headers['Location']!r}"