针对相同路径的多个Apache Location指令

时间:2012-11-08 19:54:05

标签: apache web-applications location shibboleth

我目前在两个HTTPS端口上提供了一个Web应用程序 - 假设 443 8443 。该应用程序有一个Apache HTTP服务器作为前端,我遇到了麻烦设置Apache配置以排除其中一个端口上的某些路径。我在 Apache

中设置了如下配置
<Location /MyApp>
  AuthType SOME_AUTH_MODULE
  require user valid-user
</Location>

<Location ~ "/MyApp/(Login.html|Welcome.html)">
  Satisfy Any
  Allow from all
  AuthType None
  Require all granted
</Location>

我在Apache中设置了我的虚拟主机,如下所示

<VirtualHost _default_:443>
  DocumentRoot /path/to/my/files
  Servername www.example.com:443
  Other details go here

</VirtualHost>

<VirtualHost _default_:8443>
  DocumentRoot /path/to/my/files
  Servername www.example.com:8443
  Other details go here

</VirtualHost>

考虑到 Location 指令不接受主机端口信息,上述配置存在哪些预期问题? Location指令是使用第一个匹配条目还是使用其中一个

之一

了解Shibboleth

的人的更多细节

第一个Location条目允许用户在SSO(单点登录)环境中访问应用程序。第二个条目旨在允许用户访问不同端口(8443)上的同一虚拟主机,而无需通过SSO。我们看到的是,请求标头在处理链的末尾丢失了。当我删除第二个位置条目时,一切正常。

1 个答案:

答案 0 :(得分:1)

/Location指令放在要保护的vhost指令中。

<VirtualHost _default_:443>
  DocumentRoot /path/to/my/files
  Servername www.example.com:443
  <Location /MyApp>
  AuthType SOME_AUTH_MODULE
  require user valid-user
</Location>
  Other details go here

</VirtualHost>

<VirtualHost _default_:8443>
  DocumentRoot /path/to/my/files
  Servername www.example.com:8443
  Other details go here

</VirtualHost>
相关问题