From 02931a82fd506a095ab93d6ad1d0dc416caf141d Mon Sep 17 00:00:00 2001 From: Axel Huebl Date: Sat, 7 Sep 2019 23:31:14 -0700 Subject: Add CORS for spack.packages.io Add the HTTP header `Access-Control-Allow-Origin: *` for our NGINX service that is serving static JSON content on https://spack.packages.io . --- share/spack/packages/Dockerfile | 1 + share/spack/packages/cors-header.conf | 3 +++ 2 files changed, 4 insertions(+) create mode 100644 share/spack/packages/cors-header.conf diff --git a/share/spack/packages/Dockerfile b/share/spack/packages/Dockerfile index 716a52ef68..3b9bd89ec2 100644 --- a/share/spack/packages/Dockerfile +++ b/share/spack/packages/Dockerfile @@ -7,5 +7,6 @@ RUN /build/split.sh FROM nginx:mainline-alpine COPY --from=build-env --chown=nginx:nginx /build/packages /build/packages.json /usr/share/nginx/html/api/ +COPY cors-header.conf /etc/nginx/conf.d/ CMD ["nginx", "-g", "daemon off;"] diff --git a/share/spack/packages/cors-header.conf b/share/spack/packages/cors-header.conf new file mode 100644 index 0000000000..77e34b60a4 --- /dev/null +++ b/share/spack/packages/cors-header.conf @@ -0,0 +1,3 @@ +# potentially add even more for preflight support +# https://enable-cors.org/server_nginx.html +add_header 'Access-Control-Allow-Origin' '*'; -- cgit v1.2.3-70-g09d2