HTTP Request against HTTP Server not working

I didn't get the HTTP request node to make a simple get request with no authentication or anything special.
The following flow makes a get call to "http://captive.apple.com/", a simple HTTP test site from Apple.
I tried it for several hours now with different headers and settings.
I also used the same headers as postman (no problem within postman) does, but no success.

Hope someone has an idea.

Here is the example flow:

[
    {
        "id": "80668f010bfcf02e",
        "type": "tab",
        "label": "test",
        "disabled": false,
        "info": "",
        "env": []
    },
    {
        "id": "e5dbbed115bbe75d",
        "type": "inject",
        "z": "80668f010bfcf02e",
        "name": "",
        "props": [],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "x": 290,
        "y": 380,
        "wires": [
            [
                "afecbbee2ece7590"
            ]
        ]
    },
    {
        "id": "3cf81ad95bfda998",
        "type": "debug",
        "z": "80668f010bfcf02e",
        "name": "HTTP Only Site",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "true",
        "targetType": "full",
        "statusVal": "",
        "statusType": "auto",
        "x": 720,
        "y": 380,
        "wires": []
    },
    {
        "id": "afecbbee2ece7590",
        "type": "http request",
        "z": "80668f010bfcf02e",
        "name": "HTTP Only Site",
        "method": "GET",
        "ret": "txt",
        "paytoqs": "ignore",
        "url": "http://captive.apple.com/",
        "tls": "",
        "persist": false,
        "proxy": "",
        "insecureHTTPParser": false,
        "authType": "",
        "senderr": false,
        "headers": [],
        "x": 500,
        "y": 380,
        "wires": [
            [
                "3cf81ad95bfda998"
            ]
        ]
    }
]

your flow works fine for me:

Could this be a proxy problem? I'm behind a proxy from my employer.

Maybe a firewall problem. Is Node-red installed in the same environment as Postman, or does it exist somewhere different in your employer's network?

It's both installed locally on my machine.
I can execute the proposed GET Powershell command from postman without any problem...
very strange...

What is the response or error coming from the http node.

The return value is:

{"_msgid":"c7571b75f15e27e8","payload":"RequestError: Bad response: 403 : http://captive.apple.com/","statusCode":"ERR_GOT_REQUEST_ERROR"}

Can you do a curl on the commandline on the same host ?

curl -kvvv "http://captive.apple.com/"

You mentioned that you are sitting behind a proxy, did you try to configure the proxy option in the http request node ?

The result of the curl command:

C:\Users\XXXXX>curl -kvvv "http://captive.apple.com/"
*   Trying 17.253.57.204:80...
* connect to 17.253.57.204 port 80 failed: Timed out
*   Trying 17.253.57.207:80...
* connect to 17.253.57.207 port 80 failed: Timed out
* Failed to connect to captive.apple.com port 80 after 43109 ms: Couldn't connect to server
* Closing connection 0
curl: (28) Failed to connect to captive.apple.com port 80 after 43109 ms: Couldn't connect to server

I also tried to configure the proxy in both, the node red itself & the http request node.
The proxy configuration seems valid, because I am able to download and install plugins.
But I got the same error message for my http request:

{"_msgid":"7e7928fa85ed7190","payload":"RequestError: Bad response: 403 : http://captive.apple.com/","statusCode":"ERR_GOT_REQUEST_ERROR"}

It's curious. All applications go through the same proxy. Browser works, Postman works, Powershell works, Curl form CMD doesnt work...

Powershell test, I use:

(Invoke-WebRequest -UseBasicParsing -Uri 'http://captive.apple.com').Content

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