Page MenuHomeDevCentral

No OneTemporary

diff --git a/roles/webserver-legacy/nginx/files/includes/cors-open-no-cache b/roles/webserver-legacy/nginx/files/includes/cors-open-no-cache
new file mode 100644
index 0000000..0f6baf8
--- /dev/null
+++ b/roles/webserver-legacy/nginx/files/includes/cors-open-no-cache
@@ -0,0 +1,66 @@
+# -------------------------------------------------------------
+# Configuration for Nasqueron web sites
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+# Project: Nasqueron
+# Description: nginx CORS configuration
+# Reference: Michiel Kalkman, "Wide open nginx CORS configuration",
+# https://michielkalkman.com/snippets/nginx-cors-open-configuration/
+# License: Trivial work, not eligible for copyright.
+# Source file: roles/webserver-legacy/nginx/files/includes/cors-open-no-cache
+# -------------------------------------------------------------
+#
+# <auto-generated>
+# This file is managed by our rOPS SaltStack repository.
+#
+# Changes to this file may cause incorrect behavior
+# and will be lost if the state is redeployed.
+# </auto-generated>
+
+# -------------------------------------------------------------
+# OPTIONS
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+
+if ($request_method = 'OPTIONS') {
+ add_header 'Access-Control-Allow-Origin' '*';
+ add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
+ add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range';
+ add_header 'Access-Control-Max-Age' 1728000;
+ add_header 'Content-Type' 'text/plain; charset=utf-8';
+ add_header 'Content-Length' 0;
+
+ add_header 'X-Config-Type' 'cors-open-no-cache';
+ expires off;
+ add_header 'Cache-Control' 'no-store, no-cache, must-revalidate, proxy-revalidate, max-age=0';
+
+ return 204;
+ }
+
+ # -------------------------------------------------------------
+ # GET
+ # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+
+if ($request_method = 'GET') {
+ add_header 'Access-Control-Allow-Origin' '*';
+ add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
+ add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range';
+ add_header 'Access-Control-Expose-Headers' 'Content-Length,Content-Range';
+
+ add_header 'X-Config-Type' 'cors-open-no-cache';
+ expires off;
+ add_header 'Cache-Control' 'no-store, no-cache, must-revalidate, proxy-revalidate, max-age=0';
+}
+
+# -------------------------------------------------------------
+# POST
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+
+if ($request_method = 'POST') {
+ add_header 'Access-Control-Allow-Origin' '*';
+ add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
+ add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range';
+ add_header 'Access-Control-Expose-Headers' 'Content-Length,Content-Range';
+
+ add_header 'X-Config-Type' 'cors-open-no-cache';
+ expires off;
+ add_header 'Cache-Control' 'no-store, no-cache, must-revalidate, proxy-revalidate, max-age=0';
+}
diff --git a/roles/webserver-legacy/nginx/files/vhosts/nasqueron.org/api.conf b/roles/webserver-legacy/nginx/files/vhosts/nasqueron.org/api.conf
index dd8ab83..3bd46d9 100644
--- a/roles/webserver-legacy/nginx/files/vhosts/nasqueron.org/api.conf
+++ b/roles/webserver-legacy/nginx/files/vhosts/nasqueron.org/api.conf
@@ -1,112 +1,108 @@
# -------------------------------------------------------------
# Webserver
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Project: Nasqueron
# Site: api.nasqueron.org
# License: Trivial work, not eligible to copyright
# Source file: roles/webserver-legacy/nginx/files/vhosts/nasqueron.org/api.conf
# -------------------------------------------------------------
#
# <auto-generated>
# This file is managed by our rOPS SaltStack repository.
#
# Changes to this file may cause incorrect behavior
# and will be lost if the state is redeployed.
# </auto-generated>
server {
listen 80;
listen [::]:80;
server_name api.nasqueron.org;
return 301 https://api.nasqueron.org$request_uri;
}
server {
server_name api.nasqueron.org;
include includes/tls;
ssl_certificate /usr/local/etc/letsencrypt/live/api.nasqueron.org/fullchain.pem;
ssl_certificate_key /usr/local/etc/letsencrypt/live/api.nasqueron.org/privkey.pem;
error_log /var/log/www/nasqueron.org/api-error.log;
access_log /var/log/www/nasqueron.org/api-access.log;
root /var/wwwroot/nasqueron.org/api;
include includes/letsencrypt;
location ~ [^/]\.json(/|$) {
include includes/cors-open;
}
location /datasources {
proxy_pass http://docker-001.nasqueron.org:19080;
include includes/proxy;
include includes/cors-open;
}
location = /servers-log/all.json {
- include includes/cors-open;
-
- # As a real time log, we don't want this file to be cached.
- add_header 'Cache-Control' 'no-store, no-cache, must-revalidate, proxy-revalidate, max-age=0';
- expires off;
+ include includes/cors-open-no-cache;
alias /srv/api/data/servers-log-all.json;
}
location /servers-log {
# Mount the microservice to /servers-log,
# removing the URL from the document URI.
rewrite ^/servers\-log/?(.*)$ /$1 break;
fastcgi_pass unix:/var/run/web/api.nasqueron.org/php-fpm.sock;
fastcgi_param SCRIPT_FILENAME /srv/api/servers-log/src/public/index.php;
include fastcgi_params;
}
location ~ /docker/registry/?$ {
return 302 https://docs.nasqueron.org/docker-registry-api/;
}
location /docker/registry {
proxy_pass http://docker-001.nasqueron.org:20080/;
include includes/proxy;
include includes/cors-open;
}
}
server {
listen 80;
listen [::]:80;
server_name api51.nasqueron.org;
include includes/letsencrypt;
return 301 https://api51.nasqueron.org$request_uri;
}
server {
server_name api51.nasqueron.org;
include includes/tls;
ssl_certificate /usr/local/etc/letsencrypt/live/www51.nasqueron.org/fullchain.pem;
ssl_certificate_key /usr/local/etc/letsencrypt/live/www51.nasqueron.org/privkey.pem;
error_log /var/log/www/nasqueron.org/api51-error.log;
access_log /var/log/www/nasqueron.org/api51-access.log;
root /var/51-wwwroot/api;
include includes/letsencrypt;
location ~ [^/]\.json(/|$) {
include includes/cors-open;
}
location = /servers-log/all.json {
include includes/cors-open;
alias /tmp/servers-log-all.json;
}
}

File Metadata

Mime Type
text/x-diff
Expires
Wed, Mar 18, 13:21 (14 h, 9 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3539982
Default Alt Text
(6 KB)

Event Timeline