nginx ã¯ããã©ã«ã㧠merge slash ãã
ä¹ ãã¶ãæè¡ãã¿ãä¸ã¤ã
åé¡
nginx ã reverse proxy ã¨ãã¦ä½¿ã£ã¦ããã¨
original | http://example.com/hoge/huga//path |
proxied | http://example.com/hoge/huga/path |
ã¿ãããªæãã«éãªã£ãslash ã merge ãã¦ãã proxy ããããpathæå¾ã® '//path' ã '/path' ã¨ãªã£ã¦ãç¶æ³ã«ãã£ã¦ã¯ããããããããã default ãªã®ãè¯ããã¯åãããªãããslash 㯠2 以ä¸é£ç¶ãã¦ããã¨ã1ã¤ã«ãªãã
ããã«ã
original | http://example.com/entry/http%3A%2F%2Fwww.hatena.com%2F |
proxied | http://example.com/entry/http%3A%2Fwww.hatena.com%2F |
ã¨ããã¼ã»ã³ãã¨ã³ã³ã¼ãã£ã³ã°ããã¦ãã slash ãmerge ããã¦ãã¾ãã
backend 㧠http://www.hatena.com/ ãã¨ã³ã³ã¼ãããæååãæ¥ãã¨æå¾ ãã¦ããã¨ã¯ã¾ãã
解決ç
ã§ãããã解決ããã«ã¯ nginx.conf ã®è¨å®ã«
Syntax: merge_slashes on | off
http://wiki.nginx.org/HttpCoreModule#merge_slashes
Default: on
Context: http, server
Reference: merge_slashes
ã¨ããã®ãããã®ã§ããããè¨å®ããã°ããã
ãããï¼'Context: http, server' ã¨æ¸ãã¦ãããªããããã®è¨å®ã¯ãdefault server ã®è¨å®ã«æ¸ãããhttp context ã«æ¸ããªãã¨æå¹ã«ãªããªããsee(http://nginx.org/en/docs/http/ngx_http_core_module.html#merge_slashes)
default server ã®è¨å®ã«æ¸ãã¨ããã¹ã¦ã® virtual host ã§æå¹ã«ãªãããã§ããããã virtual host ã ãæå¹/ç¡å¹ ã«ã¨ããã®ãåºæ¥ãªãããã ã
ã¾ã¨ã
nginx ã使ã£ã¦ããã¨ãã¹ã©ãã·ã¥ã®æ°ãããã¯ã¨ã³ãã§å°ãªããªã£ã¦ãã¨ãããã¨ããããè¨å®ã§ç´ãããã©ãè¨å®å ´æã«ãç½ ããããï¼ï¼ï¼