I am trying to make a POST fetch request to a remote server endpoint (, it will be inaccessible for normal GET requests, so this link won't open when you enter it in browser normally).
The code is working as expected on my local server, where I get PDF data from their server. I have deployed my project on Render, and the code fails in fetching required data upon deployment (deployed as a web service). Here is the fetch request:
const response = await fetch(";, {
agent: httpsAgent,
"headers": {
"accept": "text/html,applica...",
"accept-encoding": "gzip, deflate, br, zstd",
"accept-language": "en-US,en;q=0.6",
"cache-control": "no-cache",
"connection": "keep-alive",
"content-length": 532,
"content-type": "multipart/form-data; boundary=--******",
"host": "onlineresults.unipune.ac.in",
"origin": ";,
"pragma": "no-cache",
"Referer": "...",
"sec-ch-ua": "\"Not A(Brand...",
"sec-ch-ua-mobile": "?0",
"sec-ch-ua-platform": "\"Windows\"",
"sec-fetch-dest": "document",
"sec-fetch-mode": "navigate",
"sec-fetch-site": "same-origin",
"sec-fetch-user": "?1",
"sec-gpc": "1",
"upgrade-insecure-requests": "1",
"Referrer-Policy": "strict-origin-when-cross-origin",
"user-agent": "Mozilla/5.0 (Windo..."
},
"body": `------WebKitFormBo*****...`,
"method": "POST"
});
Note: The httpAgent is configured to make connection even if TLS certificate is not verified, because this just a small side project and I was initially getting certificate verification issues. The remote server might be a little outdated, as it still works only on HTTPv1.1.
The issue with remote endpoint is that when a request fails, it returns the HTML home page, instead of sending an error response. So I have no way of knowing why the server is rejecting my request.
Could this be due to the endpoint detecting that the request comes from Render? Is there a way to confirm this?
Is there any other reason this could be happening? If yes, how do I go about checking if that's the case?