问题原文
原帖链接 · Richard Naeve · CC BY-SA 4.0
We are using mod_rewrite with mod_proxy to proxy requests by crawlers and bots to prerender.io. The prerender service does not support https currently, but my clients site only does, so the proxy is from https to http. This used to work fine but since we updated to Apache 2.4.29 the proxy urls always have port 443 added.
Old: https://www.example.com/news/something -> http://service.prerender.io/https://www.example.com/news/something
New: https://www.example.com/news/something -> http://service.prerender.io:443/https://www.example.com/news/something
How can I revert back to the old behavior without reverting apache?
Heres the .htaccess code:
RewriteCond %{HTTP_USER_AGENT} googlebot|bingbot|baiduspider|rogerbot|embedly|quora\ link\ preview|showyoubot|outbrain [NC,OR]
RewriteCond %{HTTP_USER_AGENT} Yandex(Bot|Images|Video|Media) [NC,OR]
RewriteCond %{QUERY_STRING} _escaped_fragment_
RewriteRule ^(.*)$ http://service.prerender.io/https://%{HTTP_HOST}$1 [P,L]
已采纳解答
原帖链接 · Richard Naeve · CC BY-SA 4.0
The answer is very straight forward and easy, probably why I missed it.
Just add port 80 to the proxy url:
RewriteCond %{HTTP_USER_AGENT} googlebot|bingbot|baiduspider|rogerbot|embedly|quora\ link\ preview|showyoubot|outbrain [NC,OR]
RewriteCond %{HTTP_USER_AGENT} Yandex(Bot|Images|Video|Media) [NC,OR]
RewriteCond %{QUERY_STRING} _escaped_fragment_
RewriteRule ^(.*)$ http://service.prerender.io:80/https://%{HTTP_HOST}$1 [P,L]
摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。
