X-Forwarded-For Question

ISAPI_Rewrite is Apache mod_rewrite compatible URL rewriter for Microsoft IIS
User avatar
Posts: 5
Joined: 12 Jun 2012, 11:39

X-Forwarded-For Question

12 Jun 2012, 11:44

Hi,

I am looking for a product which will allow us to utilise the X-Forwarded-For header for inbound web requests on our Forefront TMG array (we utilise the same servers for reverse and forward proxy).

I have installed a trial version of ISAPI Rewrite and edited httpd.ini file to include the following additional entries:-

RewriteCond %REMOTE_ADDR (.+)
RewriteHeader X-Forwarded-For: (?!.).* $1

However, this will provide the X-Forwarded-For header for outbound web requests as well as inbound - we have been asked to restrict this to inbound requests only.

Any ideas???

Thanks very much!!!!

User avatar
Posts: 1264
Joined: 07 Mar 2012, 10:16

Re: X-Forwarded-For Question

13 Jun 2012, 06:23

Hello,

there're several additional questions to you:

a) Is it ISAPI_Rewrite 2 or 3? httpd.ini is supported only be v2, not 3. While this topic is in v3.
b) Hsve you installed ISAPI_Rewrite on TMG or IIS?

Regards
Andrew

User avatar
Posts: 5
Joined: 12 Jun 2012, 11:39

Re: X-Forwarded-For Question

13 Jun 2012, 06:59

Sorry for posting this in the wrong forum. The version I am testing is actually version 2, as I am using the ISA/TMG version of the product.

User avatar
Posts: 1264
Joined: 07 Mar 2012, 10:16

Re: X-Forwarded-For Question

13 Jun 2012, 09:51

Well, correct we if I'm wrong...

This rule works for you, but 2 ways, while you need to make it work only one way.
So my guess is that we need to add another condition to narrow it down.

Regards
Andrew

User avatar
Posts: 5
Joined: 12 Jun 2012, 11:39

Re: X-Forwarded-For Question

13 Jun 2012, 10:03

Hi,

Yes, that is correct. I am trying to work out what the condition would be to implement this...

Thanks v. much.

User avatar
Posts: 1264
Joined: 07 Mar 2012, 10:16

Re: X-Forwarded-For Question

13 Jun 2012, 10:26

We've researched TMG variables and found the following:

Code: Select all
IS_REVERSE_PROXY
A string containing TRUE or FALSE, indicating if the request is a forward proxy or reverse proxy request.


I think this could be a clue, just not sure which value would you need...

Regards
Andrew

User avatar
Posts: 5
Joined: 12 Jun 2012, 11:39

Re: X-Forwarded-For Question

09 Aug 2012, 07:37

Hi,

I have now tried to implement this by putting the following into the httpd.ini file:-

RewriteCond %IS_REVERSE_PROXY (True)
RewriteCond %REMOTE_ADDR (.+)
RewriteHeader X-Forwarded-For: (?!.).* $1

Unfortunately this doesn't work. I have tried values of true and false and neither of them work.

If I take the first RewriteCond line out, it works fine.

Any ideas?????

Thanks!

User avatar
Posts: 5
Joined: 12 Jun 2012, 11:39

Re: X-Forwarded-For Question

09 Aug 2012, 08:09

Beta_Tester wrote:Hi,

I have now tried to implement this by putting the following into the httpd.ini file:-

RewriteCond %IS_REVERSE_PROXY (True)
RewriteCond %REMOTE_ADDR (.+)
RewriteHeader X-Forwarded-For: (?!.).* $1

Unfortunately this doesn't work. I have tried values of true and false and neither of them work.

If I take the first RewriteCond line out, it works fine.

Any ideas?????

Thanks!


Worked it out in the end. I had to use a different TMG variable:-

RewriteCond %REVERSE_PROXY 1

:-)

Return to ISAPI_Rewrite 3.0

Who is online

Users browsing this forum: No registered users and 19 guests