【问题标题】:Multiple Apache Location directives for same path同一路径的多个 Apache 位置指令
【发布时间】:2012-10-29 02:26:23
【问题描述】:

我有一个 Web 应用程序当前在两个 HTTPS 端口上提供服务 - 比如说 4438443。该应用程序有一个 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 指令不采用 hostport 信息,上述配置的预期问题是什么? Location 指令是使用第一个匹配条目还是会使用一个之后的条目

了解 Shibboleth 的人的更多详细信息

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

【问题讨论】:

    标签: apache web-applications location shibboleth


    【解决方案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>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-01-02
      • 2016-05-23
      • 1970-01-01
      • 2012-02-23
      • 1970-01-01
      • 1970-01-01
      • 2020-06-15
      • 2011-06-20
      相关资源
      最近更新 更多