Skip to content

Open Infrastructure Map, a view of infrastructure data in OpenStreetMap

Set prod headers from container nginx

Russ Garrettc710c9f51fe3
diff --git a/Dockerfile.prod b/Dockerfile.prod
index 7cb19ea..97f27a7 100644
--- a/Dockerfile.prod
+++ b/Dockerfile.prod
@@ -7,3 +7,4 @@ RUN npm run build
FROM nginx:mainline-alpine
COPY --from=build /app/dist /usr/share/nginx/html
+COPY nginx-site.conf /etc/nginx/conf.d/default.conf
diff --git a/nginx-site.conf b/nginx-site.conf
new file mode 100644
index 0000000..013ffb1
--- /dev/null
+++ b/nginx-site.conf
@@ -0,0 +1,20 @@
+server {
+ listen 80;
+ server_name localhost;
+
+ root /usr/share/nginx/html;
+
+ # Allow CORS for JSON files
+ location ~ \.json$ {
+ add_header 'Access-Control-Allow-Origin' '*';
+ add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
+ }
+
+ location ~ \.js$ {
+ expires 30d;
+ }
+
+ location / {
+ index index.html index.htm;
+ }
+}