Dire che voglio codificare un titolo di articolo in un URL e che contiene una barra. Se io URL codificare il titolo dell'articolo ottengo:NGINX esegue il escape di% 2f su una barra. Come posso fermarlo?
http://example.com/articles/foo%2fbar/view/
Nginx passa questo al mio applicazione FastCGI come:
http://example.com/articles/foo/bar/view/
Quali invece rovina l'idea.
ho notato che se Nginx è al servizio di un file, dicono /path/to/page.html, allora può essere raggiunto in una delle seguenti due URL:
http://example.com/path/to/page.html
http://example.com/path/to%2fpage.html
Tuttavia questo non è il caso per (ad esempio) Apache.
C'è un modo per risolvere questo comportamento?
Ho provato i documenti e Google senza fortuna.
Grazie.
UPDATE
nginx config:
worker_processes 1;
pid ./nginx.pid;
events {
worker_connections 1024;
}
http {
server_tokens off;
server {
listen 80;
server_name localhost;
location /mysite/{
fastcgi_pass unix: ./mysite.fcgi.socket;
fastcgi_param SERVER_NAME $server_name;
fastcgi_param SERVER_PORT $server_port;
fastcgi_param SERVER_PROTOCOL $server_protocol;
fastcgi_param SCRIPT_NAME "/mysite/";
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param REQUEST_METHOD $request_method;
fastcgi_param QUERY_STRING $query_string;
fastcgi_param CONTENT_TYPE $content_type;
fastcgi_param CONTENT_LENGTH $content_length;
fastcgi_pass_header Authorization;
fastcgi_intercept_errors off;
}
}
}
cosa fa il tuo config nginx assomigliare? – Amber
Vedere anche https://stackoverflow.com/a/37584637/873282 – koppor