From: Nicolas Boisselier Date: Mon, 7 Oct 2024 10:37:09 +0000 (+0100) Subject: lib/php/out.php X-Git-Url: https://git.nbdom.net/?a=commitdiff_plain;h=8d88467aa913187d4f8a3e6f2c0f19e9b33d585b;p=nb.git lib/php/out.php --- diff --git a/etc/nginx/cors b/etc/nginx/cors deleted file mode 120000 index 30ec88a9..00000000 --- a/etc/nginx/cors +++ /dev/null @@ -1 +0,0 @@ -cors.conf \ No newline at end of file diff --git a/etc/nginx/cors b/etc/nginx/cors new file mode 100644 index 00000000..65af5189 --- /dev/null +++ b/etc/nginx/cors @@ -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 index 519d40d7..00000000 --- a/etc/nginx/https-only.conf +++ /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; } diff --git a/lib/php/out.php b/lib/php/out.php index 0c015225..b17fcb3d 100644 --- a/lib/php/out.php +++ b/lib/php/out.php @@ -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))); }