Hi @coelmay, thanks for your help. I have a similar proxy set up locally and it works. This particular endpoint is just the one endpoint and there are no nested paths so all requests get sent to /api as a POST with the request data in the body and I would like that POST to be redirected to https://<site-name>.com/graphql.
Is there any way I could view the server logs related to this request to see where the problem might be?
Thanks for the suggestion @coelmay, I had no idea about the Netlify CLI. When I serve the site locally using netlify dev I still get a 500 error, but I did get the following printout in the cli when I attempted to perform the proxied request:
◈ Proxying to https://<sitedomain>/graphql
[HPM] Proxy created: / -> https://<sitedomain>
[HPM] Error occurred while proxying request localhost:8888/graphql to https://<sitedomain>/ [UNABLE_TO_VERIFY_LEAF_SIGNATURE] (https://nodejs.org/api/errors.html#errors_common_system_errors)
I tried setting both NODE_TLS_REJECT_UNAUTHORIZED = '0' and NODE_EXTRA_CA_CERTS = <path-to-ca-cert> but I still get the same error.
Without being able to inspect/test myself, it’s hard to diagnose. Can you share either the repository you are deploying from or a minimal reproduction.
Just as an update, there was a pull request merged around the same time as this thread was opened which claims to have fixed this issue. So in case anyone else stumbles upon the same issue, let us know.
Hey, we’re also receiving this error. I’ve also raised a support ticket (157386) but thought I’d respond here also in case others have a similar situation.
We are rewriting portions of our URL structure to an app hosted on Vercel. These rewrites work fine most of the time but will sporadically return error 500s. We never receive an error from the Vercel origin upstream, only an error 500 when trying to reach it through the Netlify rewrites. When these errors are happening we can also see other parts of the site working fine that are served directly from Netlify.
On my site lfbb-test.netlify.app, I have a similar problem. I am redirecting some http calls to a external backend service. I see that on the backend service logs the call returns 200 code but on my frontend served by netlify I received a 500 code. I feel that the error arrives after 50 seconds and it could be the reason like a timeout. Could someone help me? On my local netlify dev with the same redirect it works fine. So I cannot reproduce localy.
Based on our logs, all the 500s have occured after about 28 seconds. When proxying from Netlify, if the response doesn’t start streaming within 28 seconds, we terminate the connection.