简体   繁体   English

具有相对URL的代理

[英]proxy with relative URLs

I'm trying to create a proxy web page that retrieves content from another website. 我正在尝试创建一个代理网页来从另一个网站检索内容。

The html content loads, but javascript/css/images using relative urls are not found as they are pointing to the local server. 加载了html内容,但是未找到使用相对URL的javascript / css / images,因为它们指向本地服务器。

Without parsing the content and re-writing urls (especially since some of the urls are generated via javascript), is there a way to specify the base url via response.headers (like in the html head) to trick the browser so that the page can continue to function? 无需解析内容并重写url(特别是由于某些url是通过javascript生成的),有一种方法可以通过response.headers(如html头中)指定基本url来欺骗浏览器,从而使页面可以继续运作吗?

尝试使用Content-Base响应标头,例如

Content-base: http://google.com/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM