skip to Main Content

I have an ELB setup for my Magento2 application. The application is running on EC2 instances. In Magento 2 I need to specify a base url for the site. I am setting that as my load balancer public dns.

When the ELB performs Health Checks on the individual EC2 Instances they are returning a 302 as magento is trying to redirect the call to the public dns record for the ELB.

How do I deal with this?

I created a file health.html and placed this in the root magento folder on the EC2 instances.

I updated the health check to load /health.html.

This works fine and the Load Balancers are able to direct traffic to these instances as they are healthy.

This is not really ideal and mainly served to verify configurations between M2 and the ELB and EC2 instances.

I would like the health check to make sure Magento2 is actually healthy.

2

Answers


  1. Chosen as BEST ANSWER

    I found the answer, There is a setting in Stores->Configuration->General->Web->Url-Options that allows you to turn off the auto redirect. I disabled this and the checks are now working


  2. You could assign the health endpoint to a magento action directly.

    I updated the health check to load /health.html.

    Set that to an HTTP request declared in your Application routes, and add your checks there. /health/action for example.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search