Custom Proxy Rules

Apr 5, 2010 at 9:08 PM

Hello all,

I am looking for a way to write a custom rule/condition that has to programmatically lookup the destination url.  Could this be covered in a custom RewriterModule?  This would be a reverse proxy scenario... basically exchanging the hostname in the request url with another one. 

I am not seeing much documentation around extending the module and was hoping to speed up my investigative process.

Thanks!

 

 

Coordinator
Apr 6, 2010 at 2:13 AM

If you are just exchanging the domain, won't this syntax work?

RewriteRule ^/(.*)$    http://proxied-domain/$1 [QSA, P]

Apr 6, 2010 at 4:01 PM

Thanks for the reply.

Based on the incoming hostname I need to look up the proxied domain from a database or whatever.

I can't have the rules for every mapping in the config file and need to do this dynamically. 

It looks like I can perhaps populate a parameter in the config file using a custom RuleAction.

I need something like:

RewriteModule  Proxied-Domain-Parameter   FranksCode.Proxy.Rules.DynamicDomainRuleAction, FranksCode.Proxy.Rules

 

RewriteRule ^/(.*)$    http://{Proxied-Domain-Parameter}/$1 [QSA, P]

Am on the right track?

Thanks

Coordinator
Apr 7, 2010 at 3:17 AM

Please check out this post. The interface is dated for the C#. But the rewriter syntax is still valid.

http://tinyurl.com/rewriter-module