-
Bug ReportI use AWS Elastic Load Balancing and was surprised to see that my server is unhealthy, yet handles requests without a problem. Upon further investigation, I discovered that the reason for that is the absence of the
This header is lacking in the raw HTTP request that the load balancer sends:
…which results in a 404 and "Severe" state in Elastic Beanstalk. Then, I tested locally and found out that this only happens in production mode. In development, it returns status code 200, regardless of Line 30 in a1813ca …I can get the same behavior in development mode as well. Steps to Reproduce
Note, however, that requesting a file from the build folder like Expected behaviorRequests to Other DetailsPayload version: 1.3.0 |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
Looking into this one @hdodov. I was able to recreate. |
Beta Was this translation helpful? Give feedback.
-
Hey @hdodov — we just looked into this in-depth and I have some explanations for you as well as a potential solution. In production, we are simply leveraging This is not something that Payload can control, and further, Instead, what you could do would be to point your health check to a custom route that you've opened, like Either that, or you could figure out if there is a way to modify the health check request that you are sending from Elastic Load Balancing to add a header to that request, which should be possible. Because really what you're telling Elastic to do is to hit a static file, with no Accept header, which will rightly 404, as there is no Accept header allowing Does that make sense? |
Beta Was this translation helpful? Give feedback.
Hey @hdodov — we just looked into this in-depth and I have some explanations for you as well as a potential solution.
In production, we are simply leveraging
express.static
to serve static files. TheAccept
header is necessary to be able to consumehtml
, etc. from a server response, and being that your health check request does not specify it, Express does not return with any results - thus 404.This is not something that Payload can control, and further,
express.static
does not have any options for how to treat theAccept
header.Instead, what you could do would be to point your health check to a custom route that you've opened, like
/health-check
and have your route return a 200.Either…