Summary: Static files are publishing in /path/to/root , If the request is not in the static folders, the request sending @a1 location block.
Static files;
/path/to/root/folder/folder1,111/index.html
/path/to/root/folder/folder1-111/index.html
Configuration
location / {
root /path/to/root;
error_page 418 = @a1;
if ($request_uri ~ .*.sort.*) { return 418; }
try_files $request_uri $request_uri/index.html $uri.html @a1;
add_header X-debug-static-1 "$request_uri" always;
}
location @a1 {
add_header X-debug-web "$request_uri" always;
include web.conf;
}
Note: web.conf going to app
static serving doesn't work, because folder name have "," character
HTTP/1.1 301 Moved Permanently
Server: nginx
Date: Thu, 30 Nov 2017 14:56:38 GMT
Content-Type: text/plain; charset=utf-8
Content-Length: 111
Connection: keep-alive
X-DNS-Prefetch-Control: off
X-Frame-Options: DENY
Strict-Transport-Security: max-age=15552000; includeSubDomains
X-Download-Options: noopen
X-Content-Type-Options: nosniff
X-XSS-Protection: 1; mode=block
Location: folder/folder1,111
Vary: Accept, Accept-Encoding
X-debug-web: https://www.example.com/folder/folder1,111
static serving works, because folder name doesn't have "," character
HTTP/1.1 200 OK
Server: nginx
Date: Thu, 30 Nov 2017 15:04:14 GMT
Content-Type: text/html
Content-Length: 306730
Last-Modified: Thu, 30 Nov 2017 15:04:09 GMT
Connection: keep-alive
Vary: Accept-Encoding
ETag: "5a201de9-4ae2a"
X-debug-static-1: /folder/folder1-111
Accept-Ranges: bytes
Q-1 https://www.example.com/folder/folder1,111 Why this request still going to @a1 location? Whereas the folder in path/to/root. So, how can I publish folders with commas in filenames from static files?
Q-2 How can I send request_uri to @a1 if the query_string contains some words?
Example;
words: sort,q,page
If the request_uri have any words from the above, send to @a1. If not, publish to the from static files.