Sorry to disappoint, that's not how CORS works. It's not a header you set in the request, but a header that the server you're requesting has to set in their response...
I will cite myself
Since the editor html is served from the same origin as the runtime, you will not have a CORS issue.
@afelix Makes sense. Looks like I will spend some time to read about CORS when i finished my custom-node
@cinhcet I now got you . There are a lot of new node-red terms I have to get familiar with. Now I understand what you mean with
endpoint solution. And now I also don't need the config node on the client side any more because the device list is retrieved at the server side.
Thank you very much for your help and your pushes to get me in the right direction with my first custom-node. With your help I enjoyed to have a steep ramp up on node-red, js, node, client/server communication, CORS, ... Actually all is used in @JGKK s code but I frankly didn't notice it's a dedicated endpoint which is used in in the client code. i was still on the server side - unfortunately.
There is still the error handling and notification missing but nevertheless I would consider the code now beta
Two final node-red questions:
- Should every device name used in a switch node as soon as it was created be disabled and no creation of switch with the same device is possible? That way every switch becomes a singleton.
- Right now it's possible to change the device name at any time. Doesn't it make sense to disable a device name change? This is somehow related to my first question.
This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.