# netfilter: redirecting based on URL

## rigor

Hi all,

I'm currently building a router based en Gentoo.

I want to filter (using layer7) incoming URLs. Like this example: 

http://www.website-1.com (internet) ---> {my router} --> (192.168.1.10) internal webserver #1

http://www.other-website-2.com (internet) ---> {my router} --> (192.168.1.11) internal webserver #2

I know I need netfilter-layer7 and iptables.

I just dont know how to put them together to make the filtering happen.

Google dosent have much on this.

Any help or shared experiance would be appreciated.

thanks,

J-F

----------

## Hu

It might be easier to use a reverse proxy than to use iptables.  A reverse proxy will not preserve the original IP address as seen by the logs of the internal webserver, but it is probably less error prone to set up and use.  If you could dedicate two public IP addresses to hosting, then you could use regular NAT, which would preserve the original IP address and be very easy to set up.

----------

## rigor

Thanks for the info.

I can see that it would be a mess and using multiple IPs would be better but for home use, when the ISP only give you 1 ip, then, something like this is needed  :Smile: 

I'll look into a reverse proxy.

Thanks.

Rigor.

----------

