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 / 问题 / 1093285
Accepted
argyrodagdileli
argyrodagdileli
Asked: 2022-02-11 06:53:22 +0800 CST2022-02-11 06:53:22 +0800 CST 2022-02-11 06:53:22 +0800 CST

代理 api 子目录时出现 Apache 500 错误

  • 772

我正在尝试将对特定端点的 PUT 请求重定向到另一台主机。

所述端点位于/internal并仅接受 PUT 请求。下面的其他端点/internal将继续由我的主主机/服务器提供服务。

我已经尝试使用重写规则和使用代理([P])标志和使用ProxyPass指令来设置它 - 所有这些都会导致 500 内部服务器错误,并且请求永远不会到达新主机

我的客户端应用程序使用无法处理重定向的简单 REST 客户端,因此我必须使用某种代理。

Apache 日志显示以下内容

[Thu Feb 10 08:56:20.394444 2022] [rewrite:trace1] [pid 8579] mod_rewrite.c(480): [client XXX.XXX.XXX.XXX:XXXXX] XXX.XXX.XXX.XXX - - [subdomain1.mydomain.com/sid#55d4ed07ecb0][rid#55d4ed2c5f20/initial] go-ahead with proxy request proxy: https://subdomain2.mydomain.com/internal/my-endpoint [OK]

这是特定虚拟主机的当前配置

<VirtualHost *:80>
 ServerName subdomain1.mydomain.com
  ProxyPass /soap ajp://localhost:7007/soap retry=3
  ProxyPreserveHost On
  Redirect /  https://subdomain1.mydomain.com/
  ErrorLog /var/log/httpd/subdomain1_error
</VirtualHost>

<VirtualHost *:443>
  ServerName subdomain1.mydomain.com
  Options FollowSymlinks
  ProxyRequests On
  ProxyPreserveHost On
  #RewriteEngine On

  #RewriteCond %{REQUEST_URI} '^/internal/my-endpoint'
  #RewriteCond %{REQUEST_METHOD} ^(PUT)
  #RewriteRule "^/(.*)" "https://subdomain2.mydomain.com/internal/my-endpoint" [P]

  ProxyPass /internal/my-endpoint https://subdomain2.mydomain.com/internal/my-endpoint
  ProxyPassReverse /internal/my-endpoint https://subdomain2.mydomain.com/internal/my-endpoint
  ProxyPreserveHost On

  LogLevel alert rewrite:trace3
  CustomLog /var/log/httpd/subdomain1_access_log common
  ProxyPass / ajp://localhost:7007/ retry=3
  ProxyPassReverse / ajp://localhost:7007/ retry=3
  ProxyPreserveHost Off
  ErrorLog /var/log/httpd/subdomain1
  SSLEngine on
</VirtualHost>
proxy mod-proxy mod-rewrite apache-2.4 500-error
  • 1 1 个回答
  • 104 Views

1 个回答

  • Voted
  1. Best Answer
    argyrodagdileli
    2022-02-12T05:27:53+08:002022-02-12T05:27:53+08:00

    好的-在 apache 日志中启用调试后,事实证明问题与 SSL 证书有关,因为代理与仅接受 HTTPS 连接的服务器有关

    必须将 apache 配置更新为以下配置才能使其正常工作

    <VirtualHost *:80>
     ServerName subdomain1.mydomain.com
      ProxyPass /soap ajp://localhost:7007/soap retry=3
      ProxyPreserveHost On
      Redirect /  https://subdomain1.mydomain.com/
      ErrorLog /var/log/httpd/subdomain1_error
    </VirtualHost>
    
    <VirtualHost *:443>
      ServerName subdomain1.mydomain.com
      Options FollowSymlinks
      ProxyRequests Off
      ProxyErrorOverride off
      ProxyPreserveHost On
    ######
      SSLEngine on
      SSLProxyEngine on
    ######
    
      ProxyPass /internal/my-endpoint https://subdomain2.mydomain.com/internal/my-endpoint
      ProxyPassReverse /internal/my-endpoint https://subdomain2.mydomain.com/internal/my-endpoint
    
      LogLevel alert rewrite:trace3
      CustomLog /var/log/httpd/subdomain1_access_log common
      ProxyPass / ajp://localhost:7007/ retry=3
      ProxyPassReverse / ajp://localhost:7007/ retry=3
      ProxyPreserveHost Off
      ErrorLog /var/log/httpd/subdomain1
      SSLEngine on
    </VirtualHost>
    
    • 1

相关问题

  • 持续监控许多服务器运行状况的简单方法?

  • Web 代理脚本与 http 代理的效率?

  • 为将笔记本电脑带回家的用户模拟公司代理

  • 什么是 Microsoft 代理客户端(MSP 客户端)

  • 使用大量 javascript 的页面上的鱿鱼速度很慢

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