Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix language changes on ipv6 and conn subdomains #1580

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
2 changes: 1 addition & 1 deletion docker/webserver/nginx_templates/app.conf.template
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ server {
# /connection/
# /connection/gettestid/
# /connection/finished/6330d6a09e56387e4dd59502418fa642/results
location ~ ^(/connection/?|/connection/gettestid/?|/connection/finished/.+)$ {
location ~ ^/(connection(/?|/gettestid/?|/finished/.+)|change_language/?)$ {
# forward information about the connecting client to the connection test
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

Expand Down
8 changes: 5 additions & 3 deletions interface/views/shared.py
Original file line number Diff line number Diff line change
Expand Up @@ -528,9 +528,11 @@ def __init__(self, redirect_to, *args, **kwargs):
super().__init__(redirect_to, *args, **kwargs)
allowed_hosts = []
for host in settings.ALLOWED_HOSTS:
allowed_hosts.append(host)
for language_code, language_name in settings.LANGUAGES:
allowed_hosts.append(language_code + host)
for optionalIPv6 in ["", ".ipv6"]:
for optionalConn in ["", ".conn"]:
allowed_hosts.append(optionalConn + optionalIPv6 + host)
for language_code, language_name in settings.LANGUAGES:
allowed_hosts.append(language_code + optionalConn + optionalIPv6 + host)

if not settings.DEBUG and not url_has_allowed_host_and_scheme(redirect_to, allowed_hosts=allowed_hosts):
raise DisallowedRedirect("Unsafe redirect to URL: %s" % redirect_to)
Loading