gpt4 book ai didi

apache - "Invalid URI in request"尝试代理 iframe 内容进行本地调试

转载 作者:行者123 更新时间:2023-12-02 03:23:16 25 4
gpt4 key购买 nike

我正在尝试调试包含 iframe 的页面中的问题。为父页面提供服务的网站是我正在处理的代码,我可以轻松地在本地运行,但 iframe 的内容来 self 无权访问的代码。有一些保护措施会阻止跨域 iframe,这在生产中不会成为问题,因为它们将在同一域上运行。但是,我需要在本地调试某些内容,因此我使用 Apache 来代理该站点。

此外,我所在的内部网络使用 Apache 必须考虑到的代理。

到目前为止我的 apache 配置:(请注意,我完全不擅长 apache 配置)

RewriteEngine on
RewriteRule ^/(.+)\.aspx(.*)$ https://www.example.com/$1.aspx$2 [PT,L]
RewriteRule ^/(.+)\.aspx$ https://www.example.com/$1.aspx [PT,L]
RewriteRule ^/static/(.+)$ https://www.example.com/static/$1 [PT,L]
RewriteCond %{SERVER_PORT} !^8080$
RewriteRule ^(.*) http://%{SERVER_NAME}:8080%{REQUEST_URI} [P,L]


#SSLProxyEngine On
ProxyRequests On
ProxyRemote http://www.example.com http://pac.group.intranet:8080
ProxyRemote https://www.example.com http://pac.group.intranet:8080

aspx/static/ 内容是我在这里尝试代理的另一个网站。我自己的网站正在端口 8080 上运行。

我目前在看似完全正常的请求中收到请求中的无效 URI。在某些时候,它似乎接受了我的请求,然后它提示 SSL,所以我添加了 SSLProxyEngine On。它目前处于关闭状态,不会生成 SSL 错误,因此显然问题发生在这之前。

添加SSLProxyEngine On后,它基本上可以工作,只是我还没有代理其他站点的静态资源。所以我添加了 /static/ 行,然后我遇到了当前的问题。

我已经在这上面花了太多时间,但我就是不明白。我找不到任何明确的示例或教程来解释如何执行此操作。这似乎是一件显而易见的事情,但我就是无法让它发挥作用。但现在删除它并不能解决问题。基本上,Apache 的行为似乎完全不可预测。我不太明白这一点,无法理解为什么。

知道是什么导致了这个问题以及如何最终让它工作吗?

我在 Windows 上使用 XAMPP 3.2.1。

日志详细信息:

[Thu Jun 19 14:25:38.879301 2014] [ssl:warn] [pid 3248:tid 220] AH01909: RSA certificate configured for www.example.com:443 does NOT include an ID which matches the server name
[Thu Jun 19 14:25:38.924310 2014] [core:warn] [pid 3248:tid 220] AH00098: pid file C:/Workset/tools/xampp/apache/logs/httpd.pid overwritten -- Unclean shutdown of previous Apache run?
[Thu Jun 19 14:25:39.262377 2014] [ssl:warn] [pid 3248:tid 220] AH01909: RSA certificate configured for www.example.com:443 does NOT include an ID which matches the server name
[Thu Jun 19 14:25:39.309387 2014] [mpm_winnt:notice] [pid 3248:tid 220] AH00455: Apache/2.4.4 (Win32) OpenSSL/0.9.8y PHP/5.4.19 configured -- resuming normal operations
[Thu Jun 19 14:25:39.309387 2014] [mpm_winnt:notice] [pid 3248:tid 220] AH00456: Server built: Feb 23 2013 13:07:34
[Thu Jun 19 14:25:39.309387 2014] [core:notice] [pid 3248:tid 220] AH00094: Command line: 'c:\\workset\\tools\\xampp\\apache\\bin\\httpd.exe -d C:/Workset/tools/xampp/apache'
[Thu Jun 19 14:25:39.310387 2014] [mpm_winnt:notice] [pid 3248:tid 220] AH00418: Parent: Created child process 7668
[Thu Jun 19 14:25:40.066538 2014] [ssl:warn] [pid 7668:tid 232] AH01909: RSA certificate configured for www.example.com:443 does NOT include an ID which matches the server name
[Thu Jun 19 14:25:40.441613 2014] [ssl:warn] [pid 7668:tid 232] AH01909: RSA certificate configured for www.example.com:443 does NOT include an ID which matches the server name
[Thu Jun 19 14:25:40.489623 2014] [mpm_winnt:notice] [pid 7668:tid 232] AH00354: Child: Starting 150 worker threads.
[Thu Jun 19 14:25:43.904305 2014] [core:error] [pid 7668:tid 1680] [client ::1:56999] AH00126: Invalid URI in request GET /foo/search/welcome.aspx?ask=bar HTTP/1.1
[Thu Jun 19 14:26:00.705665 2014] [core:error] [pid 7668:tid 1680] [client ::1:57001] AH00126: Invalid URI in request GET /foo/search/welcome.aspx?ask=bar HTTP/1.1

最佳答案

我终于成功了,我在这里为后代分享解决方案:

ProxyPassMatch ^(/.+)\.aspx(.*)$   https://www.example.com$0
ProxyPass /static https://www.example.com/
ProxyPass / http://localhost:8080/
ProxyPassReverse / http://localhost:8080/

SSLProxyEngine On
ProxyRequests On
ProxyRemote http://www.example.com http://pac.group.intranet:8080
ProxyRemote https://www.example.com http://pac.group.intranet:808

这样实际上更干净。不依赖重写规则并使用 ProxyPassMatch 进行正则表达式基本上是该解决方案的核心。

关于apache - "Invalid URI in request"尝试代理 iframe 内容进行本地调试,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24268223/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com