I’m trying to reverse proxy Caddy with Varnish to serve up Wordpress. Currently I got wordpress to work with Caddy, but I can’t get Varnish to play along. What I tried:
Direct my main site with caddy and ssl.
Installed Varnish and configured it with VCLon it’s default port.
Set Caddy as reverse proxy to Varnish.
I followed This tutorial. I think I’m missing something. I also found a github Gist which I did not understand.
Can someone please lay out the steps to configure Varnish with Caddy on Ubuntu 16.04 and Latest caddy server?
Basically I have a wordpress with Varnish and Apache configured which i use as my blog, I want to swap apache with Caddy but every time I tried it, I failed, I linked the tutorial I tried to follow.
@Cylindric do you mind sharing your vcl and caddyfile (you can edit out the domain and email if you want)?
Failed how? What are the problems you’re seeing? “It doesn’t work” doesn’t really give much information. You getting an error? Something isn’t loading? Isn’t caching? Is it Wordpress SEO that’s broken?
There’s no point me showing my VCL, even if I could, it’s over 1100 lines of stuff specific to our routing requirements.
Okay, so just to clarify, you’re using one instance of caddy as both the front-end server that the public see, and the backend server that varnish will request pages from?
“Error 503 Backend fetch failed” is basically Varnish telling you that it can’t get any data back from Caddy. What do you get if you browse to https://junayeed.me:8086? That’s what Varnish will be doing. Check your Caddy error log and access log, and see if it’s being hit at all.
You won’t get anything because Caddy is only listening on “localhost” for that port. Try setting it to just :8060 and see what you get. Or try to fetch the page from the server locally.
You need to see what Caddy is returning when someone hits that URL. Varnish is just a normal user-agent in this respect, it isn’t doing anything particularly clever.