Disabling HTTP/S error pages

I'm working on a flow that is kicked off when a user sends a GET to the right URL. For the most part, things are working, though I'd really like to just never respond to requests to a URL I don't recognize. Instead, in such cases the requesting browser receives a 504 error page from openresty. Do we have any means by which we can completely disable this error response and just leave an invalid request hanging?

Sounds like we need some more context here.

Node-RED is running behind a proxy of some sort (openresty)?

From a pure Node-RED point of view, then just never letting the incoming message request msg (from the http-in node) reach the corresponding http-response node will result in the request hanging until it times out.

1 Like

you should be able to use the :name parameters of the http in node
simple example

[{"id":"29569f8d.f8b328","type":"http in","z":"bf9e1e33.030598","name":"","url":"/:path","method":"get","upload":false,"swaggerDoc":"","x":100,"y":100,"wires":[["4b1ac59d.8892fc","a8a71e83.19f658"]]},{"id":"4b1ac59d.8892fc","type":"debug","z":"bf9e1e33.030598","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":380,"y":60,"wires":[]},{"id":"a8a71e83.19f658","type":"switch","z":"bf9e1e33.030598","name":"","property":"req.params.path","propertyType":"msg","rules":[{"t":"eq","v":"path","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":300,"y":100,"wires":[["331a26c2.34ff52"]]},{"id":"331a26c2.34ff52","type":"http response","z":"bf9e1e33.030598","name":"","statusCode":"","headers":{},"x":470,"y":100,"wires":[]}]

it will only respond if path is /path. you could also do the switch node check on msg.req.url

You know what, I just realized I'd changed the proxy I was using on my test system and that may be where I am getting that 504. I forgot all about that and was chasing it as if there was some sort of internal proxy on the node-red side of things.

edit: Thank you, Ben. I was being dumb and my own proxy was throwing the 504. I'd forgotten that I hadn't customized my 504 page yet (just my 404 page) and thought it was coming from whatever node-red was using under the hood. Just ran a test from inside that LAN and i got no response as desired. I'm away from home at a conference and I'm approaching my cognitive limit I think :sob:.

Goes to show that we need to consider the whole picture and fixating in one direction can be counterproductive.

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