server { listen *:80; listen [::]:80; # this is the internal Docker DNS, cache only for 30s resolver 127.0.0.11 valid=30s; server_name cdn.dev.d4science.org; location /health { add_header Content-Length 0; add_header Content-Type "text/plain"; return 200; } #add one such location for all new cdn islands location ~ /.*/d4s-cdn/ { if ($request_method = 'OPTIONS') { add_header Access-Control-Allow-Origin '*'; add_header Access-Control-Allow-Methods 'GET, POST, PUT, DELETE, OPTIONS'; add_header Content-Type text/plain; add_header Access-Control-Allow-Headers "Content-Type, Authorization, Accept, Origin"; add_header Content-Length 0; return 204; } add_header Access-Control-Allow-Origin *; add_header Access-Control-Allow-Methods "GET, POST, PUT, DELETE, OPTIONS"; add_header Access-Control-Allow-Headers "Content-Type, Authorization, Accept, Origin"; # use dynamic setting of upstream so that router can be started also when not all backend cdn services are deployed set $upstream cdn-pep; proxy_pass http://$upstream; } location ~* .*/d4s-vre-manager/ { if ($request_method = 'OPTIONS') { add_header Access-Control-Allow-Origin '*'; add_header Access-Control-Allow-Methods 'GET, POST, PUT, DELETE, OPTIONS'; add_header Content-Type text/plain; add_header Access-Control-Allow-Headers "Content-Type, Authorization, Accept, Origin"; add_header Content-Length 0; return 204; } add_header Access-Control-Allow-Origin *; add_header Access-Control-Allow-Methods "GET, POST, PUT, DELETE, OPTIONS"; add_header Access-Control-Allow-Headers "Content-Type, Authorization, Accept, Origin"; set $upstream d4s-vre-manager-pep; proxy_pass http://$upstream; } location ~* .*/d4s-navigation/ { if ($request_method = 'OPTIONS') { add_header Access-Control-Allow-Origin '*'; add_header Access-Control-Allow-Methods 'GET, POST, PUT, DELETE, OPTIONS'; add_header Content-Type text/plain; add_header Access-Control-Allow-Headers "Content-Type, Authorization, Accept, Origin"; add_header Content-Length 0; return 204; } add_header Access-Control-Allow-Origin *; add_header Access-Control-Allow-Methods "GET, POST, PUT, DELETE, OPTIONS"; add_header Access-Control-Allow-Headers "Content-Type, Authorization, Accept, Origin"; set $upstream d4s-navigation-pep; proxy_pass http://$upstream; } }