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

Cantaloupe reverse proxy using IP #2

Closed
wants to merge 2 commits into from
Closed
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
27 changes: 14 additions & 13 deletions nginx-vhost.conf
Original file line number Diff line number Diff line change
Expand Up @@ -11,22 +11,23 @@ server {
alias /app/iiify/static;
}

location ~ /iiif/image/([23])/(.*)$ {
rewrite ^ $request_uri;
rewrite ^/iiif/image/(2|3)/(.*)$ $2;
add_header 'Access-Control-Allow-Origin' '*' always;
add_header 'Access-Control-Allow-Methods' 'GET, HEAD, POST, PUT, PATCH, DELETE' always;
add_header 'Access-Control-Expose-Headers' '*' always;
return 302 https://services-ia-iiif-cantaloupe-experiment.dev.archive.org/iiif/$1/$2;
}
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

location ~ /iiif/image/(.*)$ {
rewrite ^ $request_uri;
rewrite ^/iiif/image/(.*)$ $1;
# 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-Path /image;
proxy_set_header X-Forwarded-For $remote_addr;

# CORS
add_header 'Access-Control-Allow-Origin' '*' always;
add_header 'Access-Control-Allow-Methods' 'GET, HEAD, POST, PUT, PATCH, DELETE' always;
add_header 'Access-Control-Expose-Headers' '*' always;
return 302 https://services-ia-iiif-cantaloupe-experiment.dev.archive.org/iiif/3/$1;
}

# Settings for IA load balancer
proxy_set_header Host cantaloupe.prod.archive.org; # So the LB knows what domain is being requested
proxy_pass https://207.241.239.241/iiif/$1/$2; # IP of LB
}
}
Loading