开发者

Replace HTTP request

开发者 https://www.devze.com 2023-02-24 05:22 出处:网络
I need to redirect http request as part of a filter addon. I am using an nsIObserverService which provides me with subject, topic, and data.

I need to redirect http request as part of a filter addon.

I am using an nsIObserverService which provides me with subject, topic, and data.

I know how to cancel the request but I need to replace th开发者_StackOverflow中文版e request with a URL to a block page.

I know how to redirect the window contents with window.content.document.location.replace but that kills all subsequent requests.

I only want to replace at the request level.

Please advise.

Thanks in advance.


on server that is processing your request try sending 301 response

for example an php redirect is like this

header('HTTP/1.1 301 Moved Permanently');
header('Location: http://www.example.com');
exit();
0

精彩评论

暂无评论...
验证码 换一张
取 消