Rewrite Rules: To Understand Better

This is a bit of a new topic for me to jump into.

Let’s say we have bananas.com running on ns1.bananas.com on our Ubuntu 16.04 box with an internal IP of 192.168.1.100.

Assuming our system is public, we setup pfSense to forward all traffic to ports 53 (DNS), 80 (HTTP), and 443 (HTTPS) to the Ubuntu box.

Now we have a fully functioning web site at the root of public_html on that server.

From here, we install another web-based service. Something like odoo, which listens on port 8069. Normally, I would have to go to https://bananas.com:8069 to get to that site, after forwarding the port in pfSense.

However, I would like to access that site at https://odoo.bananas.com without needing the port number.

Question: Do Rewrite rules circumvent the need for port forwarding on the router? Since the traffic will be coming in as 80 or 443, then forwarded to the correct port, it seems that forwarding a port in the router becomes unnecessary. Or, does the Rewrite rule simply “rewrite” the URL on the client’s browser to contain the appropriate port, thereby displaying the URL with the port number on the client’s browser?

So if I type in https://odoo.bananas.com, I will quickly see the URL rewritten to https://odoo.bananas.com:8069.

You want a ProxyPass, not a RewriteRule.

1 Like