mod_proxy_balanceré ä¸ã§ãcakephpã®redirectã使ãå ´åã®æ³¨æç¹
ãã¦ããã«ãã©ã³ã·ã³ã°
mod_proxy_balancerã使ãã¨ãæ®æ®µãã使ãæ
£ãã¦ããapacheã§ãæ軽ã«ãã¼ããã©ã³ã·ã³ã°ãè¡ããã¨ãã§ãã¾ãã
è¨å®ããã®ãããç°¡åã§ãããVirtualhostã®ä¸ã«æ¸ããã¨ãã§ããã®ã§ãNameVirtualã使ã£ãL7ãã©ã³ã·ã³ã°ããããã¨ãå¯è½ã§ãã
<Virtuslhost *:80> ServerName example.com ProxyPass / balancer://balancer/ ProxyPassReverse / balancer://balancer/ <Proxy balancer://balancer> BalancerMember http://localhost.localnet:8080 </Proxy> </Virtualhsot>
mod_proxy_balancer - Apache HTTP サーバ バージョン 2.2
ãããã·ã³ãã«ã«ããã¨ãããªæãã«ãªãã¾ãã
ãã®ã¾ã¾ã§ãåãã®ã§ãããcakephpã¨çµã¿åãããã¨1ç¹åé¡ãçãã¾ãã
redirectå¾ã®URLãã¡ãã£ã¨ãããã
cakephpã® controllerå ã§å©ç¨ãããã¨ãã§ãã $this->redirect() ã使ãã¨1ç¹åé¡ãèµ·ãã¾ãã
1. http://example.com/foo (ã¢ã¯ã»ã¹ããURLããããã/bar ã¸ãªãã¤ã¬ã¯ãããï¼ 2. http://example.com//bar (ãªãã¤ã¬ã¯ãå¾ã®URLï¼
ä¸è¨ã®ããã«ããªãã¤ã¬ã¯ãå¾ã®URLã/(ã¹ã©ãã·ã¥)ãäºéã«éãªã£ã¦ãã¾ãã¾ãã
ã¾ãåãã®ã§ãããããæ°æã¡æªãã®ã§å¯¾å¿çãèãã¦ã¿ã¾ããã
ProxyPreserveHostãã£ã¬ã¯ãã£ãã§è§£æ±º
ãªããè¯ãæ¹æ³ããªãããªã¼ã¨ããã£ã¦æ¢ãã¦ããã¨ãããæ¬å®¶ã«ãããã£ããåçãæ¸ãã¦ããã¾ãããProxyPreserveHostã¨ãããã£ã¬ã¯ãã£ãã§ãã
ãã®ãªãã·ã§ã³ãæå¹ã«ãªã£ã¦ããå ´åãProxyPassã§æå®ãããã¹ãåã®ä»£ããã«ãåãä»ãããªã¯ã¨ã¹ãã® Host: è¡ã ãããã·å ã®ãã¹ãã«éãã¾ãã
ãã®ãªãã·ã§ã³ã¯é常㯠Off ã«è¨å®ãã¦ãã ããã ã»ã¨ãã©ã®å ´åãããã¯å¤§éã®ååãã¼ã¹ã®ãã¼ãã£ã«ãã¹ãã£ã³ã°ãè¡ãªã£ã¦ãã¦ã å ã ã® Host ããããããã¯ã¨ã³ããµã¼ãã解éããå¿ è¦ã®ããã¨ãã®ãããªã ç¹å¥ãªè¨å®ãå¿ è¦ãªå ´åã«ã®ã¿æç¨ã§ãã
mod_proxy - Apache HTTP サーバ バージョン 2.2
ãããããããã¾ãã«ããã§ãããã¨ããããã§ããã1è¡ã ãã¦ãããã°OKã§ãã
ProxyPassReverseã¯ãããªããªãã®ã§ãå®æããè¨å®ãã¡ã¤ã«ã¯ãããªãã¾ãã
<Virtuslhost *:80> ServerName example.com ProxyPreserveHost On ProxyPass / balancer://balancer/ <Proxy balancer://balancer> BalancerMember http://localhost.localnet:8080 </Proxy> </Virtualhsot>
ã¨ããããã§æ¬æ¥å°ä¸æéã»ã©ããã£ã¦ãã¾ã£ãå 容ã§ããã