How to manage 3xx response from target group in ALB?

Viewed 33

I deployed an Odoo instance on ECS + FARGATE as a service, which is assigned to a target group.

On ALB I have a listener on port 443 with ACM that redirects the traffic on that target group.

The connection is working, I can reach the Odoo service from the ALB.

The problem is, Odoo can respond with 3xx codes, and I can see the url changing on the browser address bar. But instead of loading the new page, I get an error.

If resend the request directly with this same url, the one resulting from the redirect, the page loads as expected.

If I connect to the service directly, without ALB, it works fine.

From what I could understand, the ALB doesn't manage the 3xx response codes from the target group, so it gives an error.

What can i do to resolve this redirect problem?

EDIT: Problem solved, here is what i tried: I tried setting the listener on HTTP instead of HTTPS, and it worked fine. After that, i reconfigured the listener on HTTPS, and added an HTTP listener which returned a fixed response. Tried to click an url of the server which returns a 3xx code, and instead of an error i got the fixed response. In practice, the server behind the ALB listens on port 80, so when it issues a redirect, it does so on HTTP. The ALB receives in as HTTP, but wasn't listening. It was configured only on HTTPS. Hence the error. I resolved configuring two listeners:

  • an HTTPS listener which forwards traffic towards the target group
  • an HTTP listener which redirects to HTTPS
1 Answers

On ALB I have a listener on port 443 with ACM that redirects the traffic on that target group.

It forwards traffic to the target group. It does not redirect the traffic.

The problem is, Odoo can respond with 3xx codes, and I can see the url changing on the browser address bar. But instead of loading the new page, I get an error.

Including the details of that error in your question would be a key detail that needs to be included in your question. You need to edit your question to include the details of that error in order to get more detailed help.

If resend the request directly with this same url, the one resulting from the redirect, the page loads as expected.

If resending the exact request with no changes works, then there is some issue in your server software or something. There is nothing about using an ALB that would make sending the request a second time suddenly work.

From what I could understand, the ALB doesn't manage the 3xx response codes from the target group, so it gives an error.

That isn't correct. The ALB will happily send any response, with any HTTP response code, from the server back to the client. The only issue you may run into is if the health-check URL configured on the target group is sending something other than a 200 HTTP response. The health check requests are the only requests that the ALB/Target Group examine the response code on.

Related