Skip to content

HTTP In Node URL path requires trailing slash that is no shown in the UI #5594

@haku

Description

@haku

Current Behavior

Given settings.js contains:

httpNodeRoot: '/node-red/nodes',
httpNodeAuth: {user:"thing",pass:"<hash>"},

Requests only work if the path has a trailing slash:

curl -u 'thing:<pass>' -v https://example.com/node-red/nodes/shopping-list   # HTTP 401
curl -u 'thing:<pass>' -v https://example.com/node-red/nodes/shopping-list/  # HTTP 200

Even though the UI shows the node box with: "[get] /node-red/nodes/shopping-list"

Expected Behavior

The UI show show the path that should be used.

Steps To Reproduce

Create a trivial HTTP In node with method="GET" and URL="/shopping-list"

Example flow

[
    {
        "id": "8c5ba4352c53422d",
        "type": "http response",
        "z": "1a16bf399092c8c7",
        "name": "",
        "statusCode": "",
        "headers": {},
        "x": 490,
        "y": 40,
        "wires": []
    },
    {
        "id": "a50ccac34021291e",
        "type": "debug",
        "z": "1a16bf399092c8c7",
        "name": "http",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "payload",
        "targetType": "msg",
        "statusVal": "",
        "statusType": "auto",
        "x": 490,
        "y": 80,
        "wires": []
    },
    {
        "id": "3fc14dfbd15e4913",
        "type": "http in",
        "z": "1a16bf399092c8c7",
        "name": "",
        "url": "/shopping-list",
        "method": "get",
        "upload": false,
        "skipBodyParsing": false,
        "swaggerDoc": "",
        "x": 180,
        "y": 40,
        "wires": [
            [
                "8c5ba4352c53422d",
                "a50ccac34021291e"
            ]
        ]
    }
]

Environment

  • Node-RED version: 4.1.8
  • Node.js version: using the nodered/node-red:4.1.8 docker image.
  • npm version: what ever the docker image provides .
  • Platform/OS: NixOS, Nginx reverse proxy forwarding /node-red
  • Browser: Firefox

Nginx config:

location /node-red {
  return 301 /node-red/;
}
location /node-red/ {
  proxy_pass http://127.0.0.1:1880;
  proxy_cache_bypass $http_upgrade;
  proxy_set_header X-Forwarded-Port $server_port;
  proxy_set_header Upgrade $http_upgrade;
  proxy_set_header Connection $connection_upgrade;
  proxy_set_header        Host $host;
  proxy_set_header        X-Real-IP $remote_addr;
  proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;
  proxy_set_header        X-Forwarded-Proto $scheme;
  proxy_set_header        X-Forwarded-Host $host;
  proxy_set_header        X-Forwarded-Server $hostname;
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions