Guest User

Untitled

a guest
Jun 20th, 2018
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.15 KB | None | 0 0
  1. director routing_mesh round-robin {
  2. {
  3. .backend = {
  4. .host = "...some ip...";
  5. .port = "...some port...";
  6. .first_byte_timeout = 90s;
  7. .between_bytes_timeout = 90s;
  8. }
  9. # ...more backends...
  10. }
  11. }
  12.  
  13. sub vcl_recv {
  14. set req.backend = routing_mesh;
  15.  
  16. # POST, PUT, and DELETE are not cached
  17. if (req.request != "GET" && req.request != "HEAD") {
  18. return (pass);
  19. }
  20.  
  21. # never cache when http basic auth is used
  22. if (req.http.Authorization) {
  23. return (pass);
  24. }
  25.  
  26. # serve stale items for 30 seconds while fetching new item from backend
  27. set req.grace = 30s;
  28.  
  29. return (lookup);
  30. }
  31.  
  32. sub vcl_fetch {
  33. # cache 200s set to cache public
  34. if (obj.cacheable && obj.http.Cache-Control ~ "public") {
  35. set obj.prefetch = -30s;
  36. unset obj.http.set-cookie;
  37. return (deliver);
  38. }
  39.  
  40. # everything else is served dynamically
  41. return (pass);
  42. }
  43.  
  44.  
  45. sub vcl_error {
  46. set obj.http.Content-Type = "text/html; charset=utf-8";
  47. synthetic {"...error page html..."};
  48. return (deliver);
  49. }
  50.  
  51. # Disable keep-alive support with backends
  52. sub vcl_miss {
  53. set bereq.http.Connection = "close";
  54. }
  55. sub vcl_pass {
  56. set bereq.http.Connection = "close";
  57. }
  58. sub vcl_pipe {
  59. set bereq.http.Connection = "close";
  60. }
Add Comment
Please, Sign In to add comment