AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / server / 问题 / 1082652
Accepted
sgc
sgc
Asked: 2021-11-05 11:32:23 +0800 CST2021-11-05 11:32:23 +0800 CST 2021-11-05 11:32:23 +0800 CST

Apache2 VirtualHost RedirectPermanent 和 AJP 代理冲突

  • 772

事实证明,我的网站上由 ajp ProxyPass 控制的位置在 VirtualHost 重定向之前正在处理,这引起了我的注意,因为谷歌已经在 ardownload.example.org 索引了 25k+ 页面 - 我从未使用过并且不知道如何使用的子域他们开始走这条路。他们还有大约 12k 来自其他“不存在”的子域的页面。我将问题追溯到这样一个事实,即如果重定向到达 ajp 代理位置,则不尊重重定向。

期望的结果是所有子域都正确重定向到主站点,同时保留 url 和查询字符串。

部分忽略重定向的当前虚拟主机:

<VirtualHost *:80>
    ServerName example.org
    ServerAlias *.example.org
    RedirectPermanent / https://www.example.org/
</VirtualHost>

当前位置代理导致错误。

<Location /tomcatlocation/>
     ProxyPreserveHost on
     ProxyPass ajp://127.0.0.1:8009/tomcatlocation/ retry=0
     ProxyPassReverse ajp://127.0.0.1:8009/tomcatlocation/
</Location>

类似foo.example.org/tomcatlocation/或foo.example.org/tomcatlocation不会重定向的东西,而将其截断为foo.example.org/tomcatlocatio将正确重定向。

我没有运气搜索这方面的信息。谢谢。

apache2ctl -S:

VirtualHost configuration:
*:80                   is a NameVirtualHost
         default server www.example.org (/etc/apache2/sites-enabled/000-default.conf:1)
         port 80 namevhost www.example.org (/etc/apache2/sites-enabled/000-default.conf:1)
         port 80 namevhost example.org (/etc/apache2/sites-enabled/000-default.conf:10)
                 wild alias *.example.org
         port 80 namevhost example.net (/etc/apache2/sites-enabled/000-default.conf:15)

... other domains truncated ...

*:443                  is a NameVirtualHost
         default server example.org (/etc/apache2/sites-enabled/default-ssl.conf:2)
         port 443 namevhost example.org (/etc/apache2/sites-enabled/default-ssl.conf:2)
                 alias www.example.org
         port 443 namevhost example.net (/etc/apache2/sites-enabled/default-ssl.conf:25)
                 alias www.example.net
         
... other domains truncated ...


ServerRoot: "/etc/apache2"
Main DocumentRoot: "/var/www/html"
Main ErrorLog: "/var/log/apache2/error.log"
Mutex default: dir="/var/lock/apache2" mechanism=fcntl 
Mutex mpm-accept: using_defaults
Mutex watchdog-callback: using_defaults
Mutex rewrite-map: using_defaults
Mutex ssl-stapling-refresh: using_defaults
Mutex ssl-stapling: using_defaults
Mutex proxy: using_defaults
Mutex ssl-cache: using_defaults
PidFile: "/var/run/apache2/apache2.pid"
Define: DUMP_VHOSTS
Define: DUMP_RUN_CFG
User: name="www-data" id=33
Group: name="www-data" id=33
virtualhost mod-proxy-ajp apache-2.4
  • 1 1 个回答
  • 147 Views

1 个回答

  • Voted
  1. Best Answer
    sgc
    2021-11-05T18:38:47+08:002021-11-05T18:38:47+08:00

    我将Location指令移到VirtualHost:80VirtualHost重定向到的 :443 内,并且它按预期工作,因为它现在在重定向后处理。

    • 0

相关问题

  • 阿帕奇虚拟主机

  • Apache:对多个虚拟主机使用相同的目录指令

  • Apache 中的动态虚拟主机

  • VirtualHost / NameVirtualHost 背后的逻辑是什么

  • 如何设置 Jetty 6 和 Jboss 4.0.5 虚拟主机?

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    新安装后 postgres 的默认超级用户用户名/密码是什么?

    • 5 个回答
  • Marko Smith

    SFTP 使用什么端口?

    • 6 个回答
  • Marko Smith

    命令行列出 Windows Active Directory 组中的用户?

    • 9 个回答
  • Marko Smith

    什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同?

    • 3 个回答
  • Marko Smith

    如何确定bash变量是否为空?

    • 15 个回答
  • Martin Hope
    Tom Feiner 如何按大小对 du -h 输出进行排序 2009-02-26 05:42:42 +0800 CST
  • Martin Hope
    Noah Goodrich 什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同? 2009-05-19 18:24:42 +0800 CST
  • Martin Hope
    Brent 如何确定bash变量是否为空? 2009-05-13 09:54:48 +0800 CST
  • Martin Hope
    cletus 您如何找到在 Windows 中打开文件的进程? 2009-05-01 16:47:16 +0800 CST

热门标签

linux nginx windows networking ubuntu domain-name-system amazon-web-services active-directory apache-2.4 ssh

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve