0

I'm currently struggling into getting the correct configuration for my M2 shop and i can't figure out on how to troubleshoot this.

On some images, varnish backend is randomly returning 503 backend fetch, sometimes it's appearing, sometimes it's not.

I'm using Ubuntu 18.4 with Nginx / Varnish 5.2.1 and PHP 7.3.16.

Here is the content of my default.vcl: https://pastebin.com/HJ2B7pvf

Then, my nginx conf: https://pastebin.com/GDytNsht

First thing that i struggled, i could not enable the health_check no matter what i was putting on it. Each time i got a 503 backend fetch failed on this so i disabled it (tried to remove pub/). Second funny thing, i'm not able to setup MAGE_ROOT to my pub directly, each time got a 404 error.

I'm kind of stuck in there, any help would be appreciated.

Thank you!

1
  • did you manage to fix this ?
    – geryjuhasz
    Commented Nov 7, 2023 at 8:52

1 Answer 1

1

The Pastebin containing the VCL doesn't look 100% complete, so I cannot make any definitive conclusions.

However, you can use varnishlog to figure out why the HTTP 503 is returned.

General backend health

You can run varnishlog -g raw -i backend_health to see how healthy the backend is in generally. I'd make sure this command is running while you're trying to simulate the issue.

If the backend is sick, it 'll say so.

HTTP 503 for the image failure

Another thing we want to do is to look into the full request & response information when the issue occurs.

Imagine the image that is failing on you is located in /pub/img/image123.jpg. The corresponding varnishlog call to debug that image is:

varnishlog -g request -q "ReqUrl eq '/pub/img/image123.jpg'"

Send the varnishlog output

You can add the output of the varnishlog command, and I'll have a look at it.

I'd advise you to run the 2 varnishlog commands in separate Windows:

  • 1 command for the health check information
  • 1 command for the image debugging information

The combination will provide a decent amount of information to get to the bottom of the issue.

NOTE: please only send output for the request where you can simulate the issue. The output can be very verbose, so please make sure you only include logs from relevant test cases.

Happy hunting, let me know when you have something, and I'll try to assist.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.