Article From:https://segmentfault.com/q/1010000011120103
Question:

Configuring JIRA + confluences these days has been a problem, and finally a bug has been pinpointed because of an extra slash
For example (Bug)

http://confluence.test.cn//download/attachments

to (Correct)

http://confluence.test.cn/download/attachments

I modified the nginx configuration according to one point of view, but how rewirte was unsuccessful, I asked for the correct position.
Remove an extra slash

The following is my configuration. Reverse proxy

# rewrite There is no effect on how to test.Upstream confluence.test.cn {Server 192.168.1.210:10002;}Server {Listen 80;Server_name confluence.test.cn;Rewrite / / (. *) $/$1Permanent;Server_name_in_redirect off;Location / {Rewrite / / / (. *)$/$1 last;Proxy_pass http://confluence.test.cn;}}

Answer 0:
if ($request_uri ~* "\/\/") {
      rewrite ^/(.*)      $scheme://$host/$1    permanent;
    }

Let’s try it.

Leave a Reply

Your email address will not be published. Required fields are marked *