18

我有一个 HTTP Basic 安全网站。我用 mod_proxy 隐藏了一个 Tomcat 应用程序服务器。我可以删除 HTTP Basic 标头吗?Tomcat 应用程序读取标头并返回 401 未授权。不需要基本身份验证,因为应用程序使用 cookie 会话。所以我认为只需删除标题就可以了。

4

2 回答 2

28

确保 mod_headers 已启用。一个示例配置:

<VirtualHost *:80>
        ServerName something.example.com
        ServerAdmin admin@example.com

        ProxyRequests Off
        ProxyPreserveHost Off
        AllowEncodedSlashes On
        KeepAlive Off

        <Proxy *>
            Order deny,allow
            Allow from all
        </Proxy>

        <Location />
                AuthType Basic
                AuthName "Authorized Users Only"
                AuthUserFile /etc/apache2/passwd
                Require valid-user
        </Location>

        RequestHeader unset Authorization
        ProxyPass / http://localhost:5984/ example
        ProxyPassReverse / http://localhost:5984/

        ErrorLog /var/log/apache2/something.example.com-error_log
        CustomLog /var/log/apache2/something.example.com-access_log common
</VirtualHost>
于 2011-04-14T19:27:04.970 回答
15

我刚刚在另一个尝试进行基本身份验证的 Java 服务器前遇到了与 Apache 相同的问题,将以下内容添加到我的 Apache 配置中似乎可以解决它:

RequestHeader unset Authorization
于 2011-02-14T19:38:10.077 回答