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

Commit

Permalink
dont redirect build endpoint from gesis.mybinder.org (jupyterhub/mybi…
Browse files Browse the repository at this point in the history
  • Loading branch information
bitnik committed Mar 19, 2020
1 parent ff1adb7 commit 7bbeb50
Showing 1 changed file with 9 additions and 17 deletions.
26 changes: 9 additions & 17 deletions load_balancer/sites-available/gesis_mybinder
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ map $http_origin $allowed_origin {
"" "*";
}

upstream bhub {
server 194.95.75.9:30081 max_fails=0;
server 194.95.75.12:30081 max_fails=0;
}

# HTTP server to redirect gesis.mybinder.org 80 traffic to SSL/HTTPS
server {
listen 80;
Expand Down Expand Up @@ -47,22 +52,9 @@ server {
}

location /build/ {
# 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;
}
# allow all origins if request Origin is empty, otherwise allow only rquest Origin
add_header Access-Control-Allow-Origin $allowed_origin;
# to indicate to browsers that server responses can differ based on the value of the Origin request header
add_header Vary Origin;

add_header "Access-Control-Allow-Credentials" "true";
add_header 'Access-Control-Allow-Headers' 'cache-control';
add_header 'Content-Type' 'text/event-stream';
#default_type 'text/event-stream';
add_header 'Cache-Control' 'no-cache';
# use Permanent Redirect (308) instead of 301, mybinder.org redirects with 307
return 308 https://notebooks.gesis.org/binder$request_uri;
proxy_buffering off;
proxy_pass http://bhub;
include snippets/headers.conf;
proxy_set_header X-Scheme $scheme;
}
}

0 comments on commit 7bbeb50

Please sign in to comment.