Skip to search.
modperl · Perl module for Apache

Group Information

? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Hear how Yahoo! Groups has changed the lives of others. Take me there.

Messages

  Messages Help
Advanced
[mp2][QUESTION]: Filter to modify request headers on a proxy server   Message List  
Reply Message #54541 of 67621 |
Hi,

I am trying to write a filter that will sit on a proxy server and alter
HTTP requests. Basically, what I want it to do is modify the User-Agent
header field so that when the request is proxied, the remote web server
gets a different User-Agent header field to the one that was originally
sent by the browser. There are also other header fields I may need to
modify, but I would imagine this is a simple task once I've worked out
how to alter the User-Agent field.

Does anyone have any ideas how I might go about doing this? I've tried
writing several PerlInputFilterHandlers, all with no success. Will input
filters work with a proxy? I've got output filters working with no
problem.

Any sample code to do what I want, along with the relavent Apache
directives would be very much appreciated!



******** _/ ***********************************************
***** _/ ****** Chris Pringle **
**** _/ ***** **
*** _/_/_/ _/_/_/ ***** Personal Systems Group (PSG) **
*** _/ _/ _/ _/ ***** Hewlett Packard - Bristol **
*** _/ _/ _/_/_/ ***** **
**** _/ INVENT ****** Tel - +44 (0) 117 31 29664 **
****** _/ ******** Email - chris.pringle@... **
******* _/ *************************************************





Thu Sep 18, 2003 10:27 am

chris.pringle@...
Send Email Send Email

Message #54541 of 67621 |
Expand Messages Author Sort by Date

Hi, I am trying to write a filter that will sit on a proxy server and alter HTTP requests. Basically, what I want it to do is modify the User-Agent header...
Pringle, Chris (HP-PSG)
chris.pringle@... Send Email
Sep 18, 2003
10:27 am

... The sample code that you need is here: http://perl.apache.org/docs/2.0/user/handlers/filters.html#Connection_Input_Filters I haven't tried to mix filters...
Stas Bekman
stas@... Send Email
Sep 18, 2003
10:37 am

Hi, I've just tried that script again (see link below) using a POST request. In the error log file, there is the content of the POST Request e.g. ...
Pringle, Chris (HP-PSG)
chris.pringle@... Send Email
Sep 19, 2003
7:31 am

... The directive is correct, but you don't show your code and your config, so I have no idea if the rest is correct or not. This directive is used to ...
Stas Bekman
stas@... Send Email
Sep 19, 2003
7:44 am

Thanks for this. I had put 'PerlInputFilterHandler iPAQApache::ResetBrowser' inside the proxy block, and it should have been outside like you said. ********...
Pringle, Chris (HP-PSG)
chris.pringle@... Send Email
Sep 19, 2003
9:31 am

... So it did work this time, right? Perhaps we should issue a warning if a connection filter is found insider <Location> or alike. ... ...
Stas Bekman
stas@... Send Email
Sep 19, 2003
4:47 pm

... Worked perfectly this time :) I think a warning would be nice if it's not supposed to be there. If it's put within the <Proxy> tags, it only recieves the...
Pringle, Chris (HP-PSG)
chris.pringle@... Send Email
Sep 22, 2003
7:50 am
Advanced

Copyright © 2010 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines NEW - Help