Host header forwarding
-
if (req.http.host == "www.mydomain.com") { set req.backend = WebsiteBACKEND; } else if (req.http.host == "user.domain2.com") { set req.backend = WHSBACKEND; } else if (req.http.host == "mail.mydomain.com/owa") { set req.backend = ExchangeBACKEND; }
move more specific redirect to the first backend config
it should looks like this:
if (req.http.host == "mail.mydomain.com/owa") { set req.backend = ExchangeBACKEND; } else if (req.http.host == "user.domain2.com") { set req.backend = WHSBACKEND; } else if (req.http.host == "www.mydomain.com") { set req.backend = WebsiteBACKEND; }
also, paste here the return from
/usr/local/etc/rc.d/varnish.sh start -
Where should I run /usr/local/etc/rc.d/varnish.sh start ? If I SSH into the box and go to option 8 (Shell) it won't let me. If I got to the developer shell then I can enter the command and nothing happens.
-
it should return this:
/usr/local/etc/rc.d/varnish.sh start
kern.ipc.nmbclusters: 65536 sysctl: kern.ipc.nmbclusters: Invalid argument kern.ipc.somaxconn: 16384 -> 16384 kern.maxfiles: 131072 -> 131072 kern.maxfilesperproc: 104856 -> 104856 kern.threads.max_threads_per_proc: 4096 -> 4096 storage_malloc: max size 2048 MB. Using old SHMFILE
If you get any erros, it will show too.
-
I was able to run the stop/start command finally.
It gives me the following:
kern.ipc.nmbclusters: 65536
sysctl: kern.ipc.nmbclusters: Invalid argument
kern.ipc.somaxconn: 16384 -> 16384
kern.maxfiles: 131072 -> 131072
kern.maxfilesperproc: 104856 -> 104856
kern.threads.max_threads_per_proc: 4096 -> 4096
storage_malloc: max size 512 MB.
Using old SHMFILE -
So, It's running.
Go on dashboard, add varnish widget to see backend status
they may look like this:
-
Varnish is not among the list of widgets to add.
-
What varnish package version are you using? :o ???
-
2.1.5 pkg v.1.0
-
That's the last one.
The widget must be there.
status-> dashboard -> plus button -> Varnish
-
Here is the list I have.
Available Widgets
Captive Portal Status
Carp Status
Gateways
Gmirror Status
Installed Packages
Interface Statistics
Interfaces
Ipsec
Load Balancer Status
Firewall Logs
OpenVPN
Picture
Rss
Services Status
System Information
Traffic Graphs
Wake On Lan -
So after all this I re-added the Port 80 Nat rule that forwards 80 back into the pfsense box and everything started working properly. Well for the most part at least. I still have some bugs to work out but the sites are all showing up now.
I'm getting messages like this occasionally now when I try to visit the sites.
We are very sorry but an error occurred during this request.
Please press refresh in your browser to try again.
Varnish Error 503 Service Unavailable
Service Unavailable
Guru Meditation:
XID: 966503285
-
So after all this I re-added the Port 80 Nat rule that forwards 80 back into the pfsense box and everything started working properly.
Sorry but this is not an option, I think you are messing up your firewall config with a nat for the same port you are listening on.
Remove the nat and be sure you have created a rule on wan to permit connections to port 80. Simple as that.
I've checked package installation and widget is there.
fetch it to your pfsense
on console do:cd /usr/local/www/widgets/widgets/ fetch http://www.pfsense.com/packages/config/varnish64/varnish.widget.php
-
Ok I removed the NAT and kept the rule but I'm still getting 503 errors.
-
ok, good news.
the 503 erros means that varnish can't check server helth status.
you can change the probe url from "/" to a full url that you know server responds ok.
fix the widget file and you will see the backend status.
You are almost there. :)
-
The 503 error is intermittent though. It will work fine for a minute and then I get the error. Then 5 minutes later it breaks again.
-
I installed the Widget and reworked the Probe location but I still have one site that goes green and then red again and kind of bounces back and forth.
-
Varnish is a very stable solution, this intermittent error is all related to backend checks.
Check again its configuration and url used for health check.
-
Ok, everything seems to be running well now, only problem I'm having now is that authentication through this seems to be kind of touch and go. Outlook Web Access doesn't want to let me login. Any idea's what that's all about?
-
Well,
Owa is much better via https, nat 443 to owa. You do not want your domains passwords exposed.
-
I would but I need 443 for a different service.