Problems with a specific request from an HTTP Request Node

Hi all!

It seems that we have a problem with the HTTP Request node in the way it sends requests.

I have to generate a request starting by this simple curl call:

curl --location --request POST 'https://bifrost.deskera.com/v1/iam/auth/sign-in/web/sign-in' \ --header 'Content-Type: application/json' \ --data-raw '{ "password":"some_password", "userName":"some_username" }'

If i do this request using my pc console or using Postman, it works.

However, if i try to use a HTTP Request Node, it does not work and returns to me a 403 Error, like it does not send the body itself.
I have tried using the ‘Import cURL’ feature, but it still respond to me with error. Here is the node:

Have someone else experienced the same problem?

More info:

{"status":"rejected","reason":{"message":"403 - {\"type\":\"Buffer\",\"data\":[60,104,116,109,108,62,13,10,60,104,101,97,100,62,60,116,105,116,108,101,62,52,48,51,32,70,111,114,98,105,100,100,101,110,60,47,116,105,116,108,101,62,60,47,104,101,97,100,62,13,10,60,98,111,100,121,62,13,10,60,99,101,110,116,101,114,62,60,104,49,62,52,48,51,32,70,111,114,98,105,100,100,101,110,60,47,104,49,62,60,47,99,101,110,116,101,114,62,13,10,60,47,98,111,100,121,62,13,10,60,47,104,116,109,108,62,13,10]}","name":"Error","stack":"Error: Request failed with status code 403\n at createError (/usr/local/lib/node_modules/n8n/node_modules/axios/lib/core/createError.js:16:15)\n at settle (/usr/local/lib/node_modules/n8n/node_modules/axios/lib/core/settle.js:17:12)\n at IncomingMessage.handleStreamEnd (/usr/local/lib/node_modules/n8n/node_modules/axios/lib/adapters/http.js:269:11)\n at IncomingMessage.emit (node:events:525:35)\n at endReadableNT (node:internal/streams/readable:1358:12)\n at processTicksAndRejections (node:internal/process/task_queues:83:21)"}}

1 Like

Hi @Sengerio,
I just tried your request with webhook.site and it definetly sends the request body.

The only difference I can see is that the accept header overrides differently to what you set but it still contains application/json. In postman if you set the accept header to application/json,text/html,application/xhtml+xml,application/xml,text/*;q=0.9, image/*;q=0.8, */*;q=0.7 will this result in the same error?

Hi @marcus ,
Thanks for your response.

I have tried using Postman to set the accept header to application/json,text/html,application/xhtml+xml,application/xml,text/*;q=0.9, image/*;q=0.8, */*;q=0.7 and retry a call to the apis but unfortunately is still results in a success response.

I have analyzed the differences in between the Postman reqeust and HTTP Request node and have seen some headers for example content-length, user-agent, and accept-encoding, but after various trial and error to make the two requests identical, it still gives me error only on n8n.

I also add these informations:
With Postman there is an header user-agent with value PostmanRuntime/7.30.0. With n8n the same header has value axios/0.21.4. Even after trying to manually set the header ‘Postman’ on the HTTP Request node (and it is being correctly overridden) the request still response an 403.

The only thing i can think about is that n8n has some problem with sending the raw body in same way. This is the first time we are using an external service API that is requiring no query parameters, no post parameters, only raw body.

Hi all, the above would be a decimal representation of the below ASCII text coming from the server:

<html>
<head><title>403 Forbidden</title></head>
<body>
<center><h1>403 Forbidden</h1></center>
</body>
</html>

Some points that come to my mind here:

  1. Is the Postman request coming from the same machine as the n8n request? If not, could this come down to the webserver implementing a form of geoblocking?
  2. If it’s the same machine, does the curl request work through the Execute Command node?
  3. Are there any special characters in the body parameters that could cause encoding problems (from quickly trying a few likely candidates I couldn’t spot any such problems, but you never know)?

Hi @MutedJam,

thanks for your response, here are the answers to your questions:

Is the Postman request coming from the same machine as the n8n request? If not, could this come down to the webserver implementing a form of geoblocking?

The request is coming from a different machine. I have tried using Postman from my machine (and others machine on our network, all works). The n8n request comes from another machine that has installed a docker installation for n8n.

If it’s the same machine, does the curl request work through the Execute Command node?

At the moment we cannot do the curl call using the Execute Command Node because in the docker container where n8n is installed there is no curl installed. But i have tried using curl from another container from the same machine that has curl, and the response was the same 403 forbidden. If i do the curl call from another machine, it gives me correct answer.

Are there any special characters in the body parameters that could cause encoding problems (from quickly trying a few likely candidates I couldn’t spot any such problems, but you never know)?

The only special parameters present is @ from the email used for the userName params, but nothing apart that.

But i have tried using curl from another container from the same machine that has curl, and the response was the same 403 forbidden. If i do the curl call from another machine, it gives me correct answer.

So this very much sounds like your website only answers to certain source IPs (and possibly applies other criteria as well). n8n will not be able to overcome such restrictions on its own I am afraid. You could try using proxy servers, but this could be a lengthy process.

As for testing out curl, you could install it in the n8n docker container. Assuming you are using the default docker image provided by n8n you’d need to run docker exec -it n8n apk add curl (where n8n is your container name) for this.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.