HTTP in has the issues with the word "nodes"
See original GitHub issueWhat are the steps to reproduce?
Use a flow with a simple HTTP in and out:
[{"id":"6f78693d.30cbe","type":"tab","label":"Flow 1","disabled":false,"info":""},{"id":"a3ab74c8.9040e8","type":"template","z":"6f78693d.30cbe","name":"page","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"<html>\n <head></head>\n <body>\n <h1>Hello test!</h1>\n </body>\n</html>","x":411,"y":134,"wires":[["c3aa0c54.7b304"]]},{"id":"1b578e3.25238f2","type":"http in","z":"6f78693d.30cbe","name":"","url":"/nodes/test","method":"get","upload":false,"swaggerDoc":"","x":219,"y":132,"wires":[["a3ab74c8.9040e8"]]},{"id":"c3aa0c54.7b304","type":"http response","z":"6f78693d.30cbe","name":"","x":551,"y":134,"wires":[]},{"id":"88747a07.964408","type":"template","z":"6f78693d.30cbe","name":"page","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"<html>\n <head></head>\n <body>\n <h1>Hello test!</h1>\n </body>\n</html>","x":415,"y":214,"wires":[["a5dcda0f.e0ed28"]]},{"id":"2ae1cba7.f58a2c","type":"http in","z":"6f78693d.30cbe","name":"","url":"/nodes","method":"get","upload":false,"swaggerDoc":"","x":213,"y":212,"wires":[["88747a07.964408"]]},{"id":"a5dcda0f.e0ed28","type":"http response","z":"6f78693d.30cbe","name":"","x":555,"y":214,"wires":[]},{"id":"c0cc467c.5bd0b","type":"template","z":"6f78693d.30cbe","name":"page","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"<html>\n <head></head>\n <body>\n <h1>Hello test!</h1>\n </body>\n</html>","x":437,"y":301,"wires":[["1cc8dc92.010463"]]},{"id":"180af91b.2e1fb7","type":"http in","z":"6f78693d.30cbe","name":"","url":"test/nodes","method":"get","upload":false,"swaggerDoc":"","x":246,"y":295,"wires":[["c0cc467c.5bd0b"]]},{"id":"1cc8dc92.010463","type":"http response","z":"6f78693d.30cbe","name":"","x":577,"y":301,"wires":[]},{"id":"b411785e.cc7fa8","type":"template","z":"6f78693d.30cbe","name":"page","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"<html>\n <head></head>\n <body>\n <h1>Hello test!</h1>\n </body>\n</html>","x":426,"y":365,"wires":[["3c943598.ffc87a"]]},{"id":"9d4143bf.16c29","type":"http in","z":"6f78693d.30cbe","name":"","url":"test/nodes/test1","method":"get","upload":false,"swaggerDoc":"","x":254,"y":363,"wires":[["b411785e.cc7fa8"]]},{"id":"3c943598.ffc87a","type":"http response","z":"6f78693d.30cbe","name":"","x":566,"y":365,"wires":[]}]
What happens?
- When only the word nodes is used in the URL a blank page is shown, regardless of the content which should be shown
- When the word nodes is used in the URL at the beginning or somewhere in the middle between / / an error is shown
{ "code": "not_found", "message": "Error" }
- When the word nodes is used in the URL at the end the expected content is shown
What do you expect to happen?
- The word nodes should be treated as any other string in an URL and the expected content should be shown
Please tell us about your environment:
- Node-RED version: 0.20.7
- node.js version: 10.16.0
- npm version: 6.9.0
- Platform/OS: Darwin 18.6.0 x64 LE
- Browser: Firefox
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (3 by maintainers)
OK, I think I’ve found the problem.
Starting here: https://github.com/node-red/node-red/blob/8bb7b2e88b550ea05b2bfd58d9219ee7db44fe5a/packages/node_modules/%40node-red/editor-api/lib/admin/index.js#L52
These lines contain a regex that probably should have
^
at the start to stop it matching further down the path. I’ll try and find some time to stick in a pull request to fix it.Yep, that does look like it’s a problem. I can’t just off the top of my head find where the routes are set up just now. Might have to be one for Nick when he gets back from on holiday. Glad the workaround is working for now.