-
Notifications
You must be signed in to change notification settings - Fork 2
/
nginx-pfe-redirects.conf
75 lines (61 loc) · 3.1 KB
/
nginx-pfe-redirects.conf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
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/[a-zA-Z0-9_\-.]+/?$ {
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/[a-zA-Z0-9_\-.]+/((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;
}