I'm fairly new to pfSense, so bear with me please.
To summarize, I have:
- A network with split DNS enabled.
- A single IIS web server with a single IP, different sites running using different host header binding over port 80, all sites working fine for internal users.
- pfSense 2.3.4-RELEASE-p1 with Squid 0.4.40 installed on network edge.
- What I have looks like the image below:
What I'm trying to achieve:
- Publish the internal sites for external users using the same internal URLs.
- Transparent Proxy (for internal caching and CalmAV) and HTTPS are not needed.
I read that pfSense can do this trick using Reverse Proxy, I followed the steps mentioned here to enable it (with the exception of using the same 80 port for internal sites): https://www.reddit.com/r/homelab/comments/2vyiiy/til_reverse_proxy_via_squid_in_pfsense/
Problem:
- When external users type in the site URL and hit enter, the browser starts trying to connect, but after a few seconds it fails without loading the page, what is even weird is that the URL they typed is redirected from HTTP to HTTPS.
Troubleshooting:
- Disabled Transparent HTTP Proxy for internal communication.
- The Squid logs are not showing anything related to redirection of URL.
- The pfSense firewall logs shows that external users are able to connect once using HTTP, and then all the traffic is communicated using HTTPS
Questions:
- Is this scenario even valid with pfSense/Squid?
- If yes, what am I missing? if not, what is the alternative?
- Do I have to publish the sites by using different ports on IIS and enable port redirection on Pfsense? (which is the very thing that I'm trying to avoid)
Any additional steps or troubleshooting advice is very much appreciated.
Solved:
I had to spend some intimate time with the squid manual, highly recommended to really understand how it works: http://www.visolve.com/squid/whitepapers/reverseproxy.php
After reading the manual, I decided to start from scratch and do a complete reinstall of pfSense, as I started to believe that there was something wrong with the Squid services, it wasn't showing anything in the logs.
Tips and Tricks that applied to my scenario:
Because it took me some time to figure this out, I thought I'd better answer/archive my findings so I can help others who got stuck like me,
Step by step guide:
Step 1: Enable Forward Proxy by going to Services => Squid Proxy Server => General
Step 2: Enable Reverse Proxy by going to Services => Squid Reverse Proxy => General
Do all the above and save, before you proceed make sure that the squid service is up and running by browsing to: Status => Services => Squid Services Status Green, if it's not then recheck your work until it is.
Now time to define the mappings between external DNS and internal DNS
Step 3: Define the Internal Web Servers by going to Services => Squid Reverse Proxy => Web Servers
Once you're done with this, pfSense now know that there is an internal web server with the settings you just applied, you now need to tell it what does this web server have by defining mappings.
Step 4: Define internal URLs by going to Services => Squid Reverse Proxy => Mappings
After making sure that the Squid service is still running, I did a test from an external user and ta-da! it worked :)