]> git.nbdom.net Git - nb.git/commitdiff
lib/php/out.php
authorNicolas Boisselier <nicolas.boisselier@gmail.com>
Mon, 7 Oct 2024 10:37:09 +0000 (11:37 +0100)
committerNicolas Boisselier <nicolas.boisselier@gmail.com>
Mon, 7 Oct 2024 10:37:09 +0000 (11:37 +0100)
etc/nginx/cors [changed from symlink to file mode: 0644]
etc/nginx/https-only.conf [deleted file]
lib/php/out.php

deleted file mode 120000 (symlink)
index 30ec88a9df6a619c7e70a50c5b803be4e53d6d73..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-cors.conf
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..65af518938f514a6e826679a9a3af24ee3ab612d
--- /dev/null
@@ -0,0 +1,28 @@
+# cors
+if ($request_method = 'OPTIONS') {
+       add_header 'Access-Control-Allow-Origin' '*';
+       add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
+       #
+       # Custom headers and headers various browsers *should* be OK with but aren't
+       #
+       add_header 'Access-Control-Allow-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Content-Range,Range';
+       #
+       # Tell client that this pre-flight info is valid for 20 days
+       #
+       add_header 'Access-Control-Max-Age' 1728000;
+       add_header 'Content-Type' 'text/plain; charset=utf-8';
+       add_header 'Content-Length' 0;
+       return 204;
+}
+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,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Content-Range,Range';
+       add_header 'Access-Control-Expose-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Content-Range,Range';
+}
+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,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Content-Range,Range';
+       add_header 'Access-Control-Expose-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Content-Range,Range';
+}
diff --git a/etc/nginx/https-only.conf b/etc/nginx/https-only.conf
deleted file mode 100644 (file)
index 519d40d..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-set $_https_only 0;
-if ( $scheme = http ) { set $_https_only 1; }
-
-if ( $https_only = "") { set $https_only ""; }
-if ( $https_only != "") { set $_https_only $https_only; }
-
-if ( $scheme = https ) { set $_https_only 0; }
-# Live is behind a load balancer which do only http queries
-if ($http_x_forwarded_proto = "https") { set $_https_only 0; }
-
-if ( $_https_only = 1 ) { return 301 https://$host$request_uri; }
index 0c01522514daf89e11bb9e6a0ca875fdd1753789..b17fcb3d08b045f548011427ed380cf8377a9bb2 100644 (file)
@@ -453,7 +453,6 @@ Class Out extends Nb {
     $values = [];
 
     foreach (array_values($row) as $k=>$v) {
-# NB 08.05.18       if (!empty($o['quote'])) $v = self::quote($v,$o);
       $values[] = str_replace("\n",'\\n',str_replace("\r","",self::scalar($v)));
     }