Difficulty with Discourse, Apache & Varnish Cache

Hi!
Im using a reverse proxy for the discourse docker as I have other sites on my main system. I have a varnish cache infront of my apache front-end to make my sites load faster. Sometimes(after logging in) I will randomly get 503 Backend fetch failed. This only happens randomly for example, If i open any email link I get the error, If i sign up I get the same. These are just a few times i have found this to happen. Does anyone know how to fix this? Or how to disable varnish caching on 1 site?

Thanks,
Kian

I seem to have fixed this by myself. I disabled probe on my .vcl and this seemed to fix the 503 issues. Here is my .vcl for varnish incase anyone needs it(this might work for you)! :slight_smile:

vcl 4.0;

backend default {
    .host = "127.0.0.1";
    .port = "81";
    .connect_timeout = 5s;
    .first_byte_timeout = 10s;
    .between_bytes_timeout = 10s;
}
sub vcl_recv{
  unset req.http.Cookie;
if (req.http.host ~"forum.thelostworldmc.com") {
   if (!(req.url ~ "(^/uploads/|^/assets/|^/user_avatar/)" )) {
      return (pass);
   }
}
}
sub vcl_deliver {
  if (obj.hits > 0) {
    set resp.http.X-Cache = "HIT";
  } else {
    set resp.http.X-Cache = "MISS";
  }
}
2 Likes

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.