-
Notifications
You must be signed in to change notification settings - Fork 4
/
nginx-vhost.conf
47 lines (39 loc) · 1.67 KB
/
nginx-vhost.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
resolver 207.241.224.9;
server {
listen 8080;
location / {
try_files $uri @app;
}
location @app {
include uwsgi_params;
uwsgi_pass unix:///tmp/uwsgi.sock;
}
location /static {
alias /app/iiify/static;
}
location ~ /image/iiif/([23])/(.*)$ {
rewrite ^ $request_uri; # Replace nginx $uri with the unescaped version
rewrite ^/image/iiif/(2|3)/(.*)$ /iiif/$1/$2 break; # capture and reformat the URI
# Settings to ensure Cantaloupe creates the right ids
# https://cantaloupe-project.github.io/manual/5.0/deployment.html#Reverse-Proxying
proxy_set_header X-Forwarded-Host iiif.archive.org;
proxy_set_header X-Forwarded-Port 443;
proxy_set_header X-Forwarded-Proto "HTTPS";
proxy_set_header X-Forwarded-Path /image;
proxy_set_header X-Forwarded-For $remote_addr;
# CORS
# Commented out because our upstream sets these two, and having
# multiple headers of the same key causes issues.
#add_header 'Access-Control-Allow-Origin' '*' always;
#add_header 'Access-Control-Expose-Headers' '*' always;
add_header 'Access-Control-Allow-Methods' 'GET, HEAD, POST, PUT, PATCH, DELETE' always;
# Reverse proxy with the variables captured above
proxy_pass https://cantaloupe.prod.archive.org/iiif/$1/$2;
}
location /iiif/resource/ {
add_header 'Access-Control-Allow-Origin' '*' always;
add_header 'Access-Control-Allow-Methods' 'GET, HEAD, POST, PUT, PATCH, DELETE' always;
# https://archive.org/download/cruz-test/cruz-test.af.vtt
proxy_pass https://archive.org/download/;
}
}