因此我代理了一个页面(在服务器 abc 上,以便 xyz 作为代理):
ProxyPass /activation http://xyz.com:88/activation
ProxyPassReverse /activation http://xyz.com:88/activation
因此,当您在服务器 abc 上加载 xyz 页面时,地址栏中会显示 abc。
问题是页面所需的所有 css、javascript 和图像均未代理,因此浏览器显示以下内容:
GET http://abc.com/javascripts/jquery_ujs.js?1330619664 404 (Not Found)
GET http://abc.com/javascripts/addclear.js?1330619664 404 (Not Found)
GET http://abc.com/javascripts/jquery.truncate.js?1330619664 404 (Not Found)
GET http://abc.com/javascripts/jquery.min.js?1330619664 404 (Not Found)
GET http://abc.com/javascripts/jquery-ui.min.js?1330619664 404 (Not Found)
GET http://www.staticvoid.info/toggleEdit/toggleEdit.css 404 (Not Found)
GET http://abc.com/javascripts/jquery.dateFormat-1.0.js?1330619664 404 (Not Found)
GET http://abc.com/javascripts/jquery.tablesorter.min.js?1330619664 404 (Not Found)
GET http://abc.com/javascripts/rails.validations.js?1330619664 404 (Not Found)
GET http://abc.com/javascripts/rails.validations.custom.js?1330619664 404 (Not Found)
GET http://abc.com/javascripts/application/initializers.js?1330619664 404 (Not Found)
GET http://abc.com/javascripts/jquery.multiselect.js?1330619664 404 (Not Found)
GET http://abc.com/javascripts/application/toolbox.events.js?1330619664 404 (Not Found)
GET http://abc.com/stylesheets/formtastic.css?1330619664 404 (Not Found)
GET http://abc.com/stylesheets/formtastic_changes.css?1330619664 404 (Not Found)
GET http://abc.com/stylesheets/jquery.multiselect.css?1330619664 404 (Not Found)
GET http://abc.com/stylesheets/jquery.tooltip.css?1330619664 404 (Not Found)
GET http://abc.com/themes/abc/stylesheets/abc.css 404 (Not Found)
GET http://abc.com/themes/abc/stylesheets/reset.css 404 (Not Found)
GET http://abc.com/javascripts/application.js?1330619664 404 (Not Found)
GET http://abc.com/themes/abc/stylesheets/login.css 404 (Not Found)
GET http://abc.com/stylesheets/blueprint/screen.css?1330619664 404 (Not Found)
GET http://abc.com/stylesheets/application.css?1330619664 404 (Not Found)
GET http://abc.com/themes/abc/stylesheets/style.css 404 (Not Found)
GET http://abc.com/themes/abc/images/callnow.jpg 404 (Not Found)
GET http://abc.com/themes/abc/images/eagletrackgps.jpg 404 (Not Found)
GET http://abc.com/themes/abc/images/madeinamerica.jpg 404 (Not Found)
GET http://abc.com/images/btn-abc.jpg?1330619664 404 (Not Found)
GET http://abc.com/images/btn-abc.jpg?1330619664 404 (Not Found)
GET http://abc.com/images/btn-abc.jpg?1330619664 404 (Not Found)
GET http://abc.com/images/btn-abc.jpg?1330619664 404 (Not Found)
GET http://abc.com/stylesheets/blueprint/print.css?1330619664 404 (Not Found)
因此我尝试了 ProxyPassMatch 指令:
ProxyPassMatch /^(javascripts|stylesheets)$/^(.*)$ http://xyz.com:88/$1/$2
但它不起作用。上面的指令应该可以消除此错误,例如:
GET http://abc.com/javascripts/jquery_ujs.js?1330619664 404 (Not Found)
毕竟,上述请求与 url 模式匹配。
感谢回复
更新:当我修复正则表达式后它就可以工作了:
ProxyPassMatch ^/(javascripts|stylesheets)/(.*)$ http://abc.com:88/$1/$2
答案1
根据 KM01 建议使用 proxypassmatch,我解决了这个问题:
ProxyPassMatch ^/(javascripts|stylesheets)/(.*)$ http://abc.com:88/$1/$2