Say I want to encode an article title in a URL and that contains a slash. If I URL encode the article title I get:
http://example.com/articles/foo%2fbar/view/
NGINX passes this to my FastCGI application as:
http://example.com/articles/foo/bar/view/
Which rather ruins the idea.
I notice that if NGINX is serving a file, say /path/to/page.html, then it can be reached by either of the following two URLs:
http://example.com/path/to/page.html
http://example.com/path/to%2fpage.html
However this is not the case for (for example) Apache.
Is there any way to fix this behavior?
I've tried the docs and Google with no luck.
Thanks.
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;
}
}
}
Try escaping "%" as "%25"
http://example.com/articles/foo%252fbar/view/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With