我正在嘗試使用 modrewrite 進行代理 http://myserver/cam1到內部的、受 http-auth 保護的伺服器http://管理員:[電子郵件受保護]/cgi/mjpg/mjpg.cgi
但無論我如何嘗試,都要求http://myserver/cam1總是提示我輸入使用者名稱和密碼。我已經嘗試了所有這些都無濟於事。
RewriteRule ^/cam1 http://admin:[email protected]/cgi/mjpg/mjpg.cgi [P,L]
RewriteRule ^/cam1 http://192.168.99.130/cgi/mjpg/mjpg.cgi [E=Authorization:Basic\ YWRtaW46YWRtaW4=,P,L]
RewriteRule ^/cam1 http://192.168.99.130/cgi/mjpg/mjpg.cgi [E=HTTP_USERID:admin,E=HTTP_PASSWORD:admin,P,L]`
有人有其他想法嗎?
答案1
試著刪除 ^ 和 /:
RewriteRule cam1 http://admin:[email protected]/cgi/mjpg/mjpg.cgi [P,L]
RewriteRule cam1 http://192.168.99.130/cgi/mjpg/mjpg.cgi [E=Authorization:Basic\ YWRtaW46YWRtaW4=,P,L]
RewriteRule cam1 http://192.168.99.130/cgi/mjpg/mjpg.cgi [E=HTTP_USERID:admin,E=HTTP_PASSWORD:admin,P,L]
請告訴我是否有效。