How to configure HTTP/HTTPS for fetch to work?
Unanswered
European pilchard posted this in #help-forum
European pilchardOP
I am hosting a nextjs app in docker, on a server machine for work. There is an nginx reverse proxy that will server the nextjs app, and it automatically redirects to
However, my fetch requests in my server actions don't work because I need some ssl certificates.
How do I configure this in a nextjs project? Does the docker container need separate ssl certificates from the host system? Should they be the same?
Basically, I have
However, invoking this server action results in a:
I was originally getting around this by turning off
I am currently (UAT) testing this app, so the endpoints are almost prod-like, but not quite.
https.However, my fetch requests in my server actions don't work because I need some ssl certificates.
How do I configure this in a nextjs project? Does the docker container need separate ssl certificates from the host system? Should they be the same?
Basically, I have
function myAction(){
const data = fetch(/url/to/other/proprietary/app/endpoint, {
method: "POST",
headers: {
//custom headers for other app endpoint
},
body: JSON.stringify(params)
}
return data.json()
}However, invoking this server action results in a:
TypeError: fetch failed.... cause: Error: unable to get local issuer certificate.... code: "UNABLE_TO_GET_ISSUER_CERT_LOCALLY"I was originally getting around this by turning off
NODE_TLS_REJET_UNAUTHORIZED = '0', but obviously need to find a different solution to run in production. I am just unsure how to go about this. Is this because the NextJS app needs its own certs? Or the other proprietary app needs them? I am currently (UAT) testing this app, so the endpoints are almost prod-like, but not quite.