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

Commit f36b533

Browse files
committed
gesis.mybinder.org: allow OPTIONS method and do 308 redirection (jupyterhub/mybinder.org-deploy#1344)
1 parent dcc7960 commit f36b533

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

load_balancer/sites-available/gesis_mybinder

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ server {
3131

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

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

0 commit comments

Comments
 (0)