-
Notifications
You must be signed in to change notification settings - Fork 2
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
Reroute home page to FEM #372
Changes from all commits
0bcb657
61381d3
02da05a
9023920
1f09dcb
98a6d93
e683fdf
049fb13
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
set $proxy_path "www.zooniverse.org"; | ||
|
||
# FEM project assets | ||
location ~* ^/projects/(?:_next|assets)/.+?$ { | ||
resolver 1.1.1.1; | ||
proxy_pass "https://fe-project.zooniverse.org"; | ||
proxy_set_header Host fe-project.zooniverse.org; | ||
|
||
include /etc/nginx/proxy-security-headers.conf; | ||
} | ||
|
||
# PFE assets | ||
location ~ ^/[\w-]+\.(js|css)$ { | ||
resolver 1.1.1.1; | ||
proxy_pass https://zooniversestatic.z13.web.core.windows.net/$proxy_path$request_uri; | ||
include /etc/nginx/az-proxy-headers.conf; | ||
} | ||
|
||
# User profile page | ||
location ~* ^/users/[\w-]+/?$ { | ||
rewrite (?i)\.(jp(e)?g|gif|png|ico|txt|mp(3|4)|webm|og(a|g|m|v|x)|spx|opus|pdf|ttf|tar|gz|tgz|bz2|tbz2|zip)$ https://static.zooniverse.org/$proxy_path$request_uri; | ||
|
||
resolver 1.1.1.1; | ||
proxy_pass https://zooniversestatic.z13.web.core.windows.net/$proxy_path/; | ||
include /etc/nginx/az-proxy-headers.conf; | ||
} | ||
|
||
# User specific pages | ||
location ~* ^/users/[\w-]+/((collections|favorites|message)?)/?$ { | ||
rewrite (?i)\.(jp(e)?g|gif|png|ico|txt|mp(3|4)|webm|og(a|g|m|v|x)|spx|opus|pdf|ttf|tar|gz|tgz|bz2|tbz2|zip)$ https://static.zooniverse.org/$proxy_path$request_uri; | ||
|
||
resolver 1.1.1.1; | ||
proxy_pass https://zooniversestatic.z13.web.core.windows.net/$proxy_path/; | ||
include /etc/nginx/az-proxy-headers.conf; | ||
} | ||
|
||
# Default: /project/* to PFE | ||
# Can be overridden by directives in nginx-project-redirects.conf | ||
location ~* ^/projects { | ||
rewrite (?i)\.(jp(e)?g|gif|png|ico|txt|mp(3|4)|webm|og(a|g|m|v|x)|spx|opus|pdf|ttf|tar|gz|tgz|bz2|tbz2|zip)$ https://static.zooniverse.org/$proxy_path$request_uri; | ||
|
||
resolver 1.1.1.1; | ||
proxy_pass https://zooniversestatic.z13.web.core.windows.net/$proxy_path/; | ||
include /etc/nginx/az-proxy-headers.conf; | ||
} | ||
|
||
# Most of the main PFE redirects | ||
location ~* ^/(organizations|collections|favorites|talk|notifications|inbox|lab|admin|accounts|reset-password|settings|privacy|security|youth_privacy) { | ||
rewrite (?i)\.(jp(e)?g|gif|png|ico|txt|mp(3|4)|webm|og(a|g|m|v|x)|spx|opus|pdf|ttf|tar|gz|tgz|bz2|tbz2|zip)$ https://static.zooniverse.org/$proxy_path$request_uri; | ||
|
||
resolver 1.1.1.1; | ||
proxy_pass https://zooniversestatic.z13.web.core.windows.net/$proxy_path/; | ||
include /etc/nginx/az-proxy-headers.conf; | ||
} | ||
|
||
# unsubscribe route uses redirects between panoptes and the UI code | ||
# so needs it's own location block to handle the form submission POST | ||
# and the GET page loading (PFE routing handles the path) | ||
location /unsubscribe { | ||
rewrite (?i)\.(jp(e)?g|gif|png|ico|txt|mp(3|4)|webm|og(a|g|m|v|x)|spx|opus|pdf|ttf|tar|gz|tgz|bz2|tbz2|zip)$ https://static.zooniverse.org/$proxy_path$request_uri; | ||
|
||
resolver 1.1.1.1; | ||
if ($request_method ~ ^(GET|HEAD)$) { | ||
proxy_pass https://zooniversestatic.z13.web.core.windows.net/$proxy_path/; | ||
set $proxy_host_header "zooniversestatic.z13.web.core.windows.net"; | ||
} | ||
if ($request_method = POST) { | ||
proxy_pass https://panoptes.zooniverse.org$request_uri; | ||
set $proxy_host_header "panoptes.zooniverse.org"; | ||
} | ||
proxy_set_header Host $proxy_host_header; | ||
proxy_redirect /$host/ /; | ||
|
||
include /etc/nginx/az-proxy-headers.conf; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
set $proxy_path "www.zooniverse.org"; | ||
|
||
# FEM project assets | ||
location ~* ^/projects/(?:_next|assets)/.+?$ { | ||
resolver 1.1.1.1; | ||
proxy_pass "https://fe-project.preview.zooniverse.org"; | ||
proxy_set_header Host fe-project.preview.zooniverse.org; | ||
|
||
include /etc/nginx/proxy-security-headers.conf; | ||
} | ||
|
||
# PFE assets | ||
location ~ \.(js|css)$ { | ||
resolver 1.1.1.1; | ||
proxy_pass https://zooniversestatic.z13.web.core.windows.net/$proxy_path$request_uri; | ||
include /etc/nginx/az-proxy-headers.conf; | ||
} | ||
|
||
# User profile page | ||
location ~* ^/users/[\w-]+/?$ { | ||
rewrite (?i)\.(jp(e)?g|gif|png|ico|txt|mp(3|4)|webm|og(a|g|m|v|x)|spx|opus|pdf|ttf|tar|gz|tgz|bz2|tbz2|zip)$ https://static.zooniverse.org/$proxy_path$request_uri; | ||
|
||
resolver 1.1.1.1; | ||
proxy_pass https://zooniversestatic.z13.web.core.windows.net/$proxy_path/; | ||
include /etc/nginx/az-proxy-headers.conf; | ||
} | ||
|
||
# User specific pages | ||
location ~* ^/users/[\w-]+/((collections|favorites|message)?)/?$ { | ||
rewrite (?i)\.(jp(e)?g|gif|png|ico|txt|mp(3|4)|webm|og(a|g|m|v|x)|spx|opus|pdf|ttf|tar|gz|tgz|bz2|tbz2|zip)$ https://static.zooniverse.org/$proxy_path$request_uri; | ||
|
||
resolver 1.1.1.1; | ||
proxy_pass https://zooniversestatic.z13.web.core.windows.net/$proxy_path/; | ||
include /etc/nginx/az-proxy-headers.conf; | ||
} | ||
|
||
# Default: /project/* to PFE | ||
# Can be overridden by directives in nginx-project-redirects.conf | ||
location ~* ^/projects { | ||
rewrite (?i)\.(jp(e)?g|gif|png|ico|txt|mp(3|4)|webm|og(a|g|m|v|x)|spx|opus|pdf|ttf|tar|gz|tgz|bz2|tbz2|zip)$ https://static.zooniverse.org/$proxy_path$request_uri; | ||
|
||
resolver 1.1.1.1; | ||
proxy_pass https://zooniversestatic.z13.web.core.windows.net/$proxy_path/; | ||
include /etc/nginx/az-proxy-headers.conf; | ||
} | ||
|
||
# Most of the main PFE redirects | ||
location ~* ^/(organizations|collections|favorites|talk|notifications|inbox|lab|admin|accounts|reset-password|settings|privacy|security|youth_privacy) { | ||
rewrite (?i)\.(jp(e)?g|gif|png|ico|txt|mp(3|4)|webm|og(a|g|m|v|x)|spx|opus|pdf|ttf|tar|gz|tgz|bz2|tbz2|zip)$ https://static.zooniverse.org/$proxy_path$request_uri; | ||
|
||
resolver 1.1.1.1; | ||
proxy_pass https://zooniversestatic.z13.web.core.windows.net/$proxy_path/; | ||
include /etc/nginx/az-proxy-headers.conf; | ||
} | ||
|
||
# unsubscribe route uses redirects between panoptes and the UI code | ||
# so needs it's own location block to handle the form submission POST | ||
# and the GET page loading (PFE routing handles the path) | ||
location /unsubscribe { | ||
rewrite (?i)\.(jp(e)?g|gif|png|ico|txt|mp(3|4)|webm|og(a|g|m|v|x)|spx|opus|pdf|ttf|tar|gz|tgz|bz2|tbz2|zip)$ https://static.zooniverse.org/$proxy_path$request_uri; | ||
|
||
resolver 1.1.1.1; | ||
if ($request_method ~ ^(GET|HEAD)$) { | ||
proxy_pass https://zooniversestatic.z13.web.core.windows.net/$proxy_path/; | ||
set $proxy_host_header "zooniversestatic.z13.web.core.windows.net"; | ||
} | ||
if ($request_method = POST) { | ||
proxy_pass https://panoptes.zooniverse.org$request_uri; | ||
set $proxy_host_header "panoptes.zooniverse.org"; | ||
} | ||
proxy_set_header Host $proxy_host_header; | ||
proxy_redirect /$host/ /; | ||
|
||
include /etc/nginx/az-proxy-headers.conf; | ||
} | ||
|
||
# Example FEM project redirect | ||
location ~* ^/projects/(?:[\w-]*?/)?brooke/i-fancy-cats/?(?:(classify|about)(?:/.+?)?)?/?$ { | ||
resolver 1.1.1.1; | ||
proxy_pass "https://fe-project.preview.zooniverse.org"; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just flagging one specific case to ask a syntax question: should direct assignment of There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As far as I know it doesn't matter and we're just kind of inconsistent in this repo. You need quotes to avoid escaping certain characters but otherwise it works either way. |
||
proxy_set_header Host fe-project.preview.zooniverse.org; | ||
|
||
include /etc/nginx/proxy-security-headers.conf; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does the ordering of this directive, above and separate from the rest of the
projects/
pieces (starting on L37), matter?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, the ordering is important in that it's gotta be before the other projects matcher. And though I grouped it with the other asset matcher, it could be moved further down.
In this case, before matching with
~* ^/projects
, I want to check for FEM assets (the assets and _next folders) and return them first as they're exceptions to the exceptions. I could switch the latter to a prefix matcher since they have a lower priority than regex matches, but this way seems more obvious: match^/projects
plus those folders explicitly and route to FEM, or match just^/projects
and point to PFE.The FEM project redirects file itself is included first for the same reason.