0

I've set up Varnish in front of my Laravel app. My setup is this Nginx (public) -> Varnish(private) -> Nginx(private) -> PHP-Fpm(private)

Using this configuration file https://raw.githubusercontent.com/mattiasgeniar/varnish-4.0-configuration-templates/master/default.vcl with some modifications in vcl_hit replacing fetch with miss, I can get Varnish to work and I have access to the application.

Problem is that whenever I send a purge request to Varnish I get 503 Service unavailable with varnishlog showing the following:

  • << Request >> 32793
  • Begin req 32792 rxreq
  • Timestamp Start: 1553511317.806389 0.000000 0.000000
  • Timestamp Req: 1553511317.806389 0.000000 0.000000
  • ReqStart 172.22.0.3 41436
  • ReqMethod PURGE
  • ReqURL /
  • ReqProtocol HTTP/1.0
  • ReqHeader X-Real-IP: xxxxx
  • ReqHeader Host: xxxxx
  • ReqHeader Connection: close
  • ReqHeader Content-Length: 0
  • ReqHeader cache-control: no-cache
  • ReqHeader Postman-Token: 5f0fa630-edc9-4f26-b671-46559fb03004
  • ReqHeader User-Agent: PostmanRuntime/7.6.0
  • ReqHeader Accept: /
  • ReqHeader accept-encoding: gzip, deflate
  • ReqHeader X-Forwarded-For: 172.22.0.3
  • VCL_call RECV
  • ReqUnset Host: xxxxx
  • ReqHeader Host: xxxxx
  • ReqURL /
  • VCL_return purge
  • ReqUnset accept-encoding: gzip, deflate
  • ReqHeader Accept-Encoding: gzip
  • VCL_call HASH
  • VCL_return lookup
  • VCL_call PURGE
  • ReqHeader X-Purge: Yes
  • VCL_return restart
  • Timestamp Restart: 1553511317.806514 0.000126 0.000126
  • Link req 32794 restart
  • End
  • << Request >> 32794
  • Begin req 32793 restart
  • Timestamp Start: 1553511317.806514 0.000126 0.000000
  • ReqStart 172.22.0.3 41436
  • ReqMethod PURGE
  • ReqURL /
  • ReqProtocol HTTP/1.0
  • ReqHeader X-Real-IP: xxxxx
  • ReqHeader Connection: close
  • ReqHeader Content-Length: 0
  • ReqHeader cache-control: no-cache
  • ReqHeader Postman-Token: 5f0fa630-edc9-4f26-b671-46559fb03004
  • ReqHeader User-Agent: PostmanRuntime/7.6.0
  • ReqHeader Accept: /
  • ReqHeader X-Forwarded-For: 172.22.0.3
  • ReqHeader Host: xxxxx
  • ReqHeader Accept-Encoding: gzip
  • ReqHeader X-Purge: Yes
  • VCL_call RECV
  • ReqUnset Host: xxxxx
  • ReqHeader Host: xxxxx
  • ReqURL /
  • VCL_return purge
  • VCL_call HASH
  • VCL_return lookup
  • VCL_call PURGE
  • ReqUnset X-Purge: Yes
  • ReqHeader X-Purge: Yes
  • VCL_return restart
  • Timestamp Restart: 1553511317.806606 0.000217 0.000092
  • Link req 32795 restart
  • End

  • << Request >> 32795

  • Begin req 32794 restart
  • Timestamp Start: 1553511317.806606 0.000217 0.000000
  • ReqStart 172.22.0.3 41436
  • ReqMethod PURGE
  • ReqURL /
  • ReqProtocol HTTP/1.0
  • ReqHeader X-Real-IP: xxxxx
  • ReqHeader Connection: close
  • ReqHeader Content-Length: 0
  • ReqHeader cache-control: no-cache
  • ReqHeader Postman-Token: 5f0fa630-edc9-4f26-b671-46559fb03004
  • ReqHeader User-Agent: PostmanRuntime/7.6.0
  • ReqHeader Accept: /
  • ReqHeader X-Forwarded-For: 172.22.0.3
  • ReqHeader Accept-Encoding: gzip
  • ReqHeader Host: xxxxx
  • ReqHeader X-Purge: Yes
  • VCL_call RECV
  • ReqUnset Host: xxxxx
  • ReqHeader Host: xxxxx
  • ReqURL /
  • VCL_return purge
  • VCL_call HASH
  • VCL_return lookup
  • VCL_call PURGE
  • ReqUnset X-Purge: Yes
  • ReqHeader X-Purge: Yes
  • VCL_return restart
  • Timestamp Restart: 1553511317.806631 0.000242 0.000025
  • Link req 32796 restart
  • End

  • << Request >> 32796

  • Begin req 32795 restart
  • Timestamp Start: 1553511317.806631 0.000242 0.000000
  • ReqStart 172.22.0.3 41436
  • ReqMethod PURGE
  • ReqURL /
  • ReqProtocol HTTP/1.0
  • ReqHeader X-Real-IP: xxxxx
  • ReqHeader Connection: close
  • ReqHeader Content-Length: 0
  • ReqHeader cache-control: no-cache
  • ReqHeader Postman-Token: 5f0fa630-edc9-4f26-b671-46559fb03004
  • ReqHeader User-Agent: PostmanRuntime/7.6.0
  • ReqHeader Accept: /
  • ReqHeader X-Forwarded-For: 172.22.0.3
  • ReqHeader Accept-Encoding: gzip
  • ReqHeader Host: xxxxx
  • ReqHeader X-Purge: Yes
  • VCL_call RECV
  • ReqUnset Host: xxxxx
  • ReqHeader Host: xxxxx
  • ReqURL /
  • VCL_return purge
  • VCL_call HASH
  • VCL_return lookup
  • VCL_call PURGE
  • ReqUnset X-Purge: Yes
  • ReqHeader X-Purge: Yes
  • VCL_return restart
  • VCL_Error Too many restarts
  • Timestamp Process: 1553511317.806653 0.000265 0.000023
  • RespHeader Date: Mon, 25 Mar 2019 10:55:17 GMT
  • RespHeader Server: Varnish
  • RespHeader X-Varnish: 32796
  • RespProtocol HTTP/1.1
  • RespStatus 503
  • RespReason Service Unavailable
  • VCL_call SYNTH
  • VCL_return deliver
  • RespHeader Content-Length: 0
  • Storage malloc Transient
  • Debug "RES_MODE 2"
  • RespHeader Connection: close
  • Timestamp Resp: 1553511317.806823 0.000435 0.000170
  • ReqAcct 268 0 268 146 0 146
  • End

  • << Session >> 32792

  • Begin sess 0 HTTP/1
  • SessOpen 172.22.0.3 41436 0.0.0.0:80 172.22.0.22 80 1553511317.806309 17
  • Link req 32793 rxreq
  • SessClose REQ_CLOSE 0.001
  • End

I have intentionally obfuscated some IPs and hostnames in the logs. Can anyone help me figure out how to make the purge request work as intended?

  • Please copy and paste your log and use code {} formatting to format it. Also please include your Varnish configuration. – Michael Hampton Mar 25 at 13:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.