V
V
vermus2014-10-30 13:33:59
Nginx
vermus, 2014-10-30 13:33:59

What characters are allowed in $request_uri in nginx?

There is the following config
nginx.org/en/docs/http/converting_rewrite_rules.html

server {
    listen       80;
    server_name  example.org;
    return       301 http://www.example.org$request_uri;
}

server {
    listen       80;
    server_name  www.example.org;
    ...
}

The problem is that redirects from a uri containing parentheses occur to the main one, that is, the rewust_uri is discarded.
wiki/%D0%A2%D0%B0%D0%B9%D0%BC%D1%8B%D1%80%20(%D0%BF%D0%BE%D0%BB%D1%83%D0%BE% D1%81%D1%82%D1%80%D0%BE%D0%B2)
while uris of the form are redirected quietly.
wiki/%D0%9A%D0%B0%D0%B2%D0%BA%D0%B0%D0%B7%D1%81%D0%BA%D0%B8%D0%B9%20%D0%B7%D0 %B0%D0%BF%D0%BE%D0%B2%D0%B5%D0%B4%D0%BD%D0%B8%D0%BA
According to https://www.ietf.org/rfc/rfc1738.txt encode for brackets is not needed.
Thus, only alphanumerics, the special characters "$-_.+!*'(),", and
reserved characters used for their reserved purposes may be used
unencoded within a URL.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
Power, 2014-10-30
@vermus

I tried, I have a normal redirect with brackets:

HTTP/1.1 301 Moved Permanently
Server: nginx/1.6.2
...
Location: http://www.example.org/wiki/%D0%A2%D0%B0%D0%B9%D0%BC%D1%8B%D1%80%20(%D0%BF%D0%BE%D0%BB%D1%83%D0%BE%D1%81%D1%82%D1%80%D0%BE%D0%B2)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question