diff --git a/docs/example-advanced.nginx.conf b/docs/example-advanced.nginx.conf index 9902c31bf..556829935 100644 --- a/docs/example-advanced.nginx.conf +++ b/docs/example-advanced.nginx.conf @@ -234,6 +234,20 @@ server { add_header Cross-Origin-Embedder-Policy require-corp; } + location ~ ^/extensions.js { + proxy_pass http://localhost:3000; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header Host $host; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + + # These settings prevent both NGINX and the API server + # from setting the same headers and creating duplicates + proxy_hide_header Cross-Origin-Resource-Policy; + add_header Cross-Origin-Resource-Policy cross-origin; + proxy_hide_header Cross-Origin-Embedder-Policy; + add_header Cross-Origin-Embedder-Policy require-corp; + } + # Requests for blobs and blocks are now proxied to the API server # This simplifies NGINX path configuration in the event they are being hosted in a non-standard location # or with odd unexpected permissions. Serving blobs in this manner also means that it will be possible to diff --git a/www/common/extensions.js b/www/common/extensions.js index 134c71113..e8bfa654c 100644 --- a/www/common/extensions.js +++ b/www/common/extensions.js @@ -2,6 +2,13 @@ define([ 'optional!/extensions.js' ], (Extensions) => { const ext = {}; + + ext.getExtensions = id => { + let e = ext[id]; + if (!Array.isArray(e)) { e = []; } + return e; + }; + if (!Array.isArray(Extensions) || !Extensions.length) { return ext; } let all = Extensions.slice(); @@ -48,11 +55,5 @@ define([ }); } - ext.getExtensions = id => { - let e = ext[id]; - if (!Array.isArray(e)) { e = []; } - return e; - }; - return ext; });