diff --git a/Design:-Custom-Node-admin-route-handling.md b/Design:-Custom-Node-admin-route-handling.md new file mode 100644 index 0000000..3c1deeb --- /dev/null +++ b/Design:-Custom-Node-admin-route-handling.md @@ -0,0 +1,31 @@ +Nodes are able to add their own custom routes to the `RED.httpAdmin` express app. This allows them to: + + - provide their own admin routes - such as the Serial node's ability to query active ports on the host + - serve up additional content - such as Debug loading its shared .js library and node-red-node-geofence loading the leaflet.js library and associated resources. + +Within the editor, as long as their reference those routes with a relative url, they will work regardless of what `httpAdminRoot` is set to. + +This poses some problems for the split of the editor and runtime. + +One of the goals of the split is to be able to serve the editor from a static file server (eg AWS S3) and point it at a server hosting the admin api. At this point, any relative urls a custom node uses will break - as they will be relative to the S3 url, not the admin api url. + +There are a number of ways a user may access these custom routes - each needs a slightly different solution. + +| Type of route | Resolution | +| ------------- | ------------- | +| `$.ajax` call | We already use `$.ajaxSetup()` to attach access tokens to relative urls. That can be updated to rewrite urls | +| **Adding scripts to the page** | | +| `$.getScript` | Also covered by `$.ajaxSetup()` fix | +| `