简体   繁体   English

设置 mod_proxy 以将 http 身份验证传递给服务器

[英]Setting up mod_proxy to pass http authentication to server

I have a problem configuring Apache as a proxy server.我在将 Apache 配置为代理服务器时遇到问题。 At the moment I access a MS Sharepoint installation using domain.net over Port 80. Before being able to use it I have to enter username and password.目前,我使用 domain.net 通过端口 80 访问 MS Sharepoint 安装。在能够使用它之前,我必须输入用户名和密码。 So far so good.到目前为止,一切都很好。

Now I want to be able to access a website over a subdomain web.domain.net.现在我希望能够通过子域 web.domain.net 访问网站。 The Server hosting this site runs on another machine in the internal network.托管此站点的服务器运行在内部网络中的另一台机器上。 The solution I came up with is to redirect port 80 to the machine running apache to serve the new website and proxy any requests for the sharepoint to the sharepoint server.我想出的解决方案是将端口 80 重定向到运行 apache 的机器以服务于新网站并将 sharepoint 的任何请求代理到 sharepoint 服务器。

So far I enabled all the proxy modules in my httpd.conf and added a virtual host.到目前为止,我在 httpd.conf 中启用了所有代理模块并添加了一个虚拟主机。 EDIT: Updated config after first responses.编辑:第一次响应后更新配置。

<VirtualHost *:80>
    ServerName domain.net

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

    ProxyErrorOverride On
    ProxyPass   /   http://sharepoint/
    ProxyPassReverse   /   http://sharepoint/

    <Location />
        AuthType basic
        AuthBasicAuthoritative Off
        SetEnv proxy-chain-auth On
        Order allow,deny
        Allow from all
    </Location>
</VirtualHost>

This works.这行得通。 Entering domain.net forwards me to the sharepoint server.输入 domain.net 会将我转发到 sharepoint 服务器。 Now comes the actually problem.现在真正的问题来了。 The sharepoint asks me for my credentials. sharepoint 要求我提供凭据。 But when I enter them the login form keeps popping up as I entered no or incorrect username and password.但是当我输入它们时,登录表单会不断弹出,因为我没有输入或输入错误的用户名和密码。

It seems like the credentials aren't forwarded to the sharepoint through the proxy.似乎凭据没有通过代理转发到 sharepoint。

Can you give me any advise how to solve this?你能给我任何建议如何解决这个问题吗? Is it possible to do this using mod_proxy?是否可以使用 mod_proxy 做到这一点?

See http://httpd.apache.org/docs/2.2/mod/mod_proxy_http.html : there is a proxy-chain-auth environmental variable that should forward the credentials on to the proxied server.请参阅http://httpd.apache.org/docs/2.2/mod/mod_proxy_http.html :服务器上应该有一个proxy-chain-auth上的证书转发环境变量。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM