Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow requests to internal IPs #149

Open
kosimst opened this issue Jun 8, 2022 · 2 comments
Open

Allow requests to internal IPs #149

kosimst opened this issue Jun 8, 2022 · 2 comments

Comments

@kosimst
Copy link

kosimst commented Jun 8, 2022

Is your feature request related to a problem? Please describe.
My ioBroker instance is hosted in a private network and cannot be reached from outside. I would like to access the API from a Web App I plan to host publicly. As CORS blocks any requests to internal IPs, this is not possible at the moment.

Describe the solution you'd like
In order to allow websites to reach the API on an internal IP, Simple API needs to respond to a preflight request from the browser. Details are described here: https://developer.chrome.com/blog/private-network-access-preflight/. For optimal control and security, an two additional options would need to be added to the admin settings page: One checkbox to enable/disable internal IP access. This reflects on the response to the preflight response. The second option would be an input for domains allowed to access the API on a private IP.

Describe alternatives you've considered
Without this option, web either need to be hosted inside the same private network as the Simple API instance or Simple API needs to be accessible from the outside.

@Apollon77
Copy link
Contributor

I think thiswould then be also (more) relevant for web adapter and pot. more adpters with an own HTTP server

@kosimst
Copy link
Author

kosimst commented Jun 9, 2022

Not necessarily for the web adapter, I don't think any web app would need to access the ioBroker UI. My use case only depends on this API, so I can't speak for other adapters with a web server. I tried to implement it myself on a fork of this adapter, but I didn't find a way to implement the two additional options. In the actual backend, I think there would only be an additional endpoint handler for OPTION requests necessary that sets the required headers accordingly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants