Guest User

Untitled

a guest
May 2nd, 2020
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.92 KB | None | 0 0
  1. # VCL version 5.0 is not supported so it should be 4.0 even though actually used Varnish version is 5
  2. vcl 4.0;
  3.  
  4. import std;
  5. # The minimal Varnish version is 5.0
  6. # For SSL offloading, pass the following header in your proxy server or load balancer: 'X-Forwarded-Proto: https'
  7.  
  8. backend default {
  9. .host = "localhost";
  10. .port = "8080";
  11. .first_byte_timeout = 600s;
  12. .probe = {
  13. #.url = "/pub/health_check.php";
  14. .timeout = 2s;
  15. #.interval = 5s;
  16. #.window = 10;
  17. #.threshold = 5;
  18. }
  19. }
  20.  
  21. acl purge {
  22. "localhost";
  23. }
  24.  
  25. sub vcl_recv {
  26. if (req.method == "PURGE") {
  27. if (client.ip !~ purge) {
  28. return (synth(405, "Method not allowed"));
  29. }
  30. # To use the X-Pool header for purging varnish during automated deployments, make sure the X-Pool header
  31. # has been added to the response in your backend server config. This is used, for example, by the
  32. # capistrano-magento2 gem for purging old content from varnish during it's deploy routine.
  33. if (!req.http.X-Magento-Tags-Pattern && !req.http.X-Pool) {
  34. return (synth(400, "X-Magento-Tags-Pattern or X-Pool header required"));
  35. }
  36. if (req.http.X-Magento-Tags-Pattern) {
  37. ban("obj.http.X-Magento-Tags ~ " + req.http.X-Magento-Tags-Pattern);
  38. }
  39. if (req.http.X-Pool) {
  40. ban("obj.http.X-Pool ~ " + req.http.X-Pool);
  41. }
  42. return (synth(200, "Purged"));
  43. }
  44.  
  45. if (req.method != "GET" &&
  46. req.method != "HEAD" &&
  47. req.method != "PUT" &&
  48. req.method != "POST" &&
  49. req.method != "TRACE" &&
  50. req.method != "OPTIONS" &&
  51. req.method != "DELETE") {
  52. /* Non-RFC2616 or CONNECT which is weird. */
  53. return (pipe);
  54. }
  55.  
  56. # We only deal with GET and HEAD by default
  57. if (req.method != "GET" && req.method != "HEAD") {
  58. return (pass);
Add Comment
Please, Sign In to add comment