2014-06-17 27 views
3

我試圖在包含iframe的頁面中調試問題。提供父頁面的網站是我正在處理的代碼,我可以輕鬆地在本地運行,但iframe的內容來自我無權訪問的代碼。有一些保護阻止跨域iframing,這不會在生產中出現問題,因爲它們將在同一個域上運行。但是,我需要在本地調試某些東西,所以我使用Apache來代理該網站。「請求中的URI無效」試圖爲本地調試代理iframe內容

此外,我所使用的內部網絡使用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上運行。

我目前正在對看起來完全正常的請求獲得Invalid URI in request。在某個時候它似乎接受我的請求,然後它抱怨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 
+0

你的apache錯誤日誌顯示任何有意義的東西嗎?我不確定apache級別的錯誤是否會在那裏報告,如果我遇到問題,我會首先考慮它。 – ThorSummoner

+0

如果你的項目只是開發,然後使用http。這可能是因爲你在做什麼或者加載內容的事情需要https,而另一部分是提供http。 –

+0

apache錯誤日誌說:[[Thu Jun 19 14:25:43.904305 2014] [core:error] [pid 7668:tid 1680] [client :: 1:56999] AH00126:請求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:請求中URI無效GET/foo/search/welcome.aspx?ask = bar HTTP/1.' – mcv

回答

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作爲正則表達式基本上是解決方案的核心。