我正在尝试使用 modrewrite 来代理 http://我的服务器/cam1到受 http-auth 保护的内部服务器http://管理员:[电子邮件保护]/cgi/mjpg/mjpg.cgi
无论我怎么尝试,请求http://我的服务器/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]
如果它有效,请告诉我。