Skip to content
This repository has been archived by the owner on Jun 15, 2023. It is now read-only.

Commit

Permalink
gesis.mybinder.org: allow OPTIONS method and do 308 redirection (jupy…
Browse files Browse the repository at this point in the history
  • Loading branch information
bitnik committed Feb 20, 2020
1 parent dcc7960 commit f36b533
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions load_balancer/sites-available/gesis_mybinder
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ server {

location / {
# https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/301
limit_except GET {
limit_except GET OPTIONS {
deny all;
}
# https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS
Expand All @@ -40,11 +40,13 @@ server {
add_header 'Cache-Control' 'no-cache';
# https://serverfault.com/questions/426673/nginx-redirect-subdomain-to-sub-directory
# https://www.nginx.com/resources/wiki/start/topics/tutorials/config_pitfalls/#taxing-rewrites
return 301 https://notebooks.gesis.org/binder$request_uri;
return 308 https://notebooks.gesis.org/binder$request_uri;
}

location /build/ {
limit_except GET {
# add OPTIONS for Preflighted requests: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS
# adding OPTIONS is just to be safe, I am not sure if this is preflighted
limit_except GET OPTIONS {
deny all;
}
add_header Access-Control-Allow-Origin $allowed_origin;
Expand All @@ -53,7 +55,7 @@ server {
add_header 'Access-Control-Allow-Headers' 'cache-control';
add_header 'Content-Type' 'text/event-stream';
add_header 'Cache-Control' 'no-cache';
return 301 https://notebooks.gesis.org/binder$request_uri;
# use Permanent Redirect (308) instead of 301, mybinder.org redirects with 307
return 308 https://notebooks.gesis.org/binder$request_uri;
}
}

0 comments on commit f36b533

Please sign in to comment.