æ¨æ© twitter ã§ããããã¯ã¨ã³ãã®ã»ã㧠Digest èªè¨¼ããã¦ããã¨ããã« mod_proxy 㧠Reverse proxy ã§ããªããã¨ãã話ããã£ãã®ã§ã¡ãã£ã¨è©¦ãã¦ã¿ãã
ããï¼mod_proxyã¨ãã ã¨digestèªè¨¼åºæ¥ãªãã®ãï¼ãªãã¼ã¹ãããã·ã«ã¢ã¯ã»ã¹ããæç¹ã§èªè¨¼ãããå½¢ã¨ãmod_rewriteã§ã´ãã§ã´ãã§ãããæ¹æ³ã¨ãããç¡ãã®ããªã
çµè«ããè¨ãã¨ã
- uri (path) ã表ã¨è£ã§åä¸ãªãåé¡ãªã
- å¥ã® uri ( 表:/foo => è£:/bar ãªã© ) ã ã¨èªè¨¼ã«å¤±æãã
ã¨ããçµæã«ã
Digest èªè¨¼ã®ã¢ã«ã´ãªãºã ã§ã¯ãAuthorization ãããã®çæã« uri ã使ç¨ãããããã¯ã©ã¤ã¢ã³ããèªèãã¦ãã uri ã¨ããã¯ã¨ã³ããèªèãã¦ãã uri ãç°ãªãã¨ãããã®æ¤è¨¼ã«å¤±æãããã¨ããã®ãåå ãããã
ä»å㯠reverse proxy ãããã¯ã¨ã³ãã Apache-2.2 ã ãã©ãããããä»ã® web server ã§ãäºæ ã¯åãã¯ãã
以ä¸æ¤è¨¼ä½æ¥ãã°ã
å®ã¯ Digest èªè¨¼ãã¡ããã¨ä½¿ã£ããã¨ããªãã£ãã®ã§é©å½ã«è¨å®ãããã¯ã¨ã³ã㯠CentOS-5 / Apache-2.2.3
AuthType Digest AuthName "Secret Zone" AuthDigestDomain /digest/ AuthDigestProvider file AuthUserFile /tmp/htdigest Require user secret
$ htdigest -c /tmp/htdigest "Secret Zone" secret
Reverse Proxy 㯠Apache-2.2.17 ãã½ã¼ã¹ãã proxy æå¹ã«ãã¦ã¤ã³ã¹ãã¼ã«ã
$ ./configure --enable-proxy --prefix=/path/to/apache
httpd.conf ã« ProxyPass è¨å®
Listen 10080 ProxyPass /digest http://127.0.0.1/digest
ããã§è¡¨ãè£ã /digest ã¨ãã uri ã«ãªãããããã ã¨åé¡ãªãèªè¨¼ãéãã
ProxyPass /xxxxxx http://127.0.0.1/digest
ãã®ããã«ã表 /xxxxxx => è£ /digest ã¨ããã¨ãè£ã®ã»ãã§ã¨ã©ã¼ãã°ã«
Digest: uri mismatch - </xxxxxx/> does not match request-uri </digest/>
ã¨è¨é²ããã400 Bad Request ã«ãªãã