# Difficoltà con Discourse, Apache e Varnish Cache

**URL:** https://meta.discourse.org/t/difficulty-with-discourse-apache-varnish-cache/197917
**Category:** Self-hosting
**Created:** [22 Luglio 2021, 9:16pm UTC](https://meta.discourse.org/t/difficulty-with-discourse-apache-varnish-cache/197917 "2021-07-22T21:16:44Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![kianwalters05](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/kianwalters05/32/228402_2.png) [@kianwalters05](https://meta.discourse.org/u/kianwalters05)
#### Post date: [22 Luglio 2021, 9:16pm UTC](https://meta.discourse.org/t/difficulty-with-discourse-apache-varnish-cache/197917/1 "2021-07-22T21:16:44Z")

</div>

Ciao!  
Sto utilizzando un reverse proxy per il Docker di Discourse, poiché ho altri siti sul mio sistema principale. Ho una cache Varnish davanti al mio front-end Apache per rendere i siti più veloci. A volte (dopo aver effettuato l’accesso) ricevo casualmente un errore 503 “Backend fetch failed”. Questo accade in modo casuale; ad esempio, se apro un link email ottengo l’errore, se mi registro ottengo lo stesso. Questi sono solo alcuni dei casi in cui ho notato questo problema. Qualcuno sa come risolvere? O come disabilitare la cache Varnish per un solo sito?

Grazie,  
Kian

---

<div class="post-metadata">

### Author: ![kianwalters05](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/kianwalters05/32/228402_2.png) [@kianwalters05](https://meta.discourse.org/u/kianwalters05)
#### Post date: [23 Luglio 2021, 12:59pm UTC](https://meta.discourse.org/t/difficulty-with-discourse-apache-varnish-cache/197917/2 "2021-07-23T12:59:59Z")

</div>

Sembra che io abbia risolto il problema da solo. Ho disabilitato il probe nel mio file .vcl e questo ha risolto i problemi 503. Ecco il mio file .vcl per Varnish, nel caso qualcuno ne abbia bisogno (potrebbe funzionare anche per voi)! 🙂

```plaintext
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";
  }
}

```

---

<div class="post-metadata">

### Author: ![system](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/system/32/443519_2.png) [@system](https://meta.discourse.org/u/system)
#### Post date: [22 Agosto 2021, 1:00pm UTC](https://meta.discourse.org/t/difficulty-with-discourse-apache-varnish-cache/197917/3 "2021-08-22T13:00:20Z")

</div>

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