# How do I setup Varnish properly?

**URL:** https://discourse.roots.io/t/how-do-i-setup-varnish-properly/3531
**Category:** trellis
**Created:** 2015-04-17T09:57:25Z
**Posts:** 4
**Showing post:** 3 of 4

## Post 3 by @teohhanhui — 2015-04-18T05:14:54Z

That’s exactly what I did. The problem is WordPress (via [redirect\_canonical](http://codex.wordpress.org/Function_Reference/redirect_canonical) I think) does a 301 redirect when it sees that the port doesn’t match.

Tried adding `port_in_redirect off;` to nginx server block but it didn’t seem to help…

And the funny thing is I already strip off the port from HTTP `Host` header in my .vcl file. Should I not be doing that? (Oh wait… This only matters if the request URL from browser contains a port number. Nevermind…)

---

_[View the full topic](https://discourse.roots.io/t/how-do-i-setup-varnish-properly/3531)._
