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

Loading History-Graph fails #24

Open
micdis opened this issue Sep 9, 2021 · 13 comments
Open

Loading History-Graph fails #24

micdis opened this issue Sep 9, 2021 · 13 comments

Comments

@micdis
Copy link

micdis commented Sep 9, 2021

Hi!

as switching to the AddOn, I do get the following errors on my history-graph-tiles:

[Error] Preflight response is not successful [Error] XMLHttpRequest cannot load https://xxxx.ui.nabu.casa/api/history/period/2x021-09-02T19:15:20.359Z?end_time=2021-09-09T19:15:20.359Z&filter_entity_id=sensor.bl_berlin_weekincidence due to access control checks. [Error] Failed to load resource: Preflight response is not successful (2021-09-02T19:15:20.359Z, line 0)

any Idea, why tailboard tries to load the data over nabucasa and not locally?
thanks in advance,
Michael

edit: I'm not using ingress, but a configured port for using it with my old android tablets!

@rchl
Copy link
Contributor

rchl commented Sep 9, 2021

I believe that the addon will use the URL configured on the /config/core HA page (the General Configuration page). You should have External URL and Internal URL there and it will pick the first one that is set.

@rchl
Copy link
Contributor

rchl commented Sep 9, 2021

BTW. The root issue is in HA (see resoai/TileBoard#386) but using the same URL for the REST API calls as you are using for opening the TileBoard itself will work around it.

@micdis
Copy link
Author

micdis commented Sep 10, 2021

till now the external URL wasn't set. I put the same internal IP on both URLs, but this does not resolve the problem. :-(

the error is the same, but now with the internal IP:

[Error] Preflight response is not successful [Error] XMLHttpRequest cannot load https://192.168.178.44:8123/api/history/period/2021-09-03T06:43:29.512Z?end_time=2021-09-10T06:43:29.512Z&filter_entity_id=sensor.bl_berlin_weekincidence due to access control checks. [Error] Failed to load resource: Preflight response is not successful (2021-09-03T06:43:29.512Z, line 0)

@rchl
Copy link
Contributor

rchl commented Sep 10, 2021

Is your local URL https://192.168.178.44:8123 or http://192.168.178.44:8123 (https vs. http)? You shouldn't get that issue if the origin of the URL is the same.

@micdis
Copy link
Author

micdis commented Sep 10, 2021

I changed both (tileboard and HA) to use SSL

@rchl
Copy link
Contributor

rchl commented Sep 10, 2021

That doesn't quite make sense to me if both the URL in the browser field and the failing request start with the same protocol, domain and port. Browsers only trigger preflight requests when those don't match.

@micdis
Copy link
Author

micdis commented Sep 11, 2021

the error-message in the Log of the AdOn is:
OCSP response not successful (6: unauthorized) while requesting certificate status, responder: ocsp.int-x3.letsencrypt.org, peer: IP:80, certificate: "/ssl/fullchain.pem"

@rchl
Copy link
Contributor

rchl commented Sep 12, 2021

Maybe don't use SSL since you don't seem to have a proper SSL certificate for your URL (I think that it's not even possible to have a valid certificate for a local IP).

@micdis
Copy link
Author

micdis commented Sep 16, 2021

I tried to switch off the SSL option in configuration tab of the AddOn too, but it does not make any difference - the error stays:

[Error] Preflight response is not successful

[Error] XMLHttpRequest cannot load https://HA_URL.ui.nabu.casa/api/history/period/2021-09-09T19:48:08.933Z?end_time=2021-09-16T19:48:08.933Z&filter_entity_id=sensor.bl_berlin_weekincidence due to access control checks.

[Error] Failed to load resource: Preflight response is not successful (2021-09-09T19:48:08.933Z, line 0)

@rchl
Copy link
Contributor

rchl commented Sep 16, 2021

It should work when TileBoard is loaded from http://192.168.178.44:8123 and is requesting the API at http://192.168.178.44:8123. It seems like before you were able to make the API request to https://192.168.178.44:8123 so now it should just be a matter of switching to HTTP for both.

@micdis
Copy link
Author

micdis commented Sep 16, 2021

TileBoard keeps routing to https://nabucasa... no matter what I do put into "external URL".... :- (

edit: I did switch to non-ssl http on both ends!

@rchl
Copy link
Contributor

rchl commented Sep 16, 2021

I would have to look at that at some point. The logic tries to guess the used URL to make experience smoother but it apparently goes wrong when using HA cloud.

I don't have a cloud account so not sure if I'll be able to investigate it but will see...

@bigstation17
Copy link

I have same issue :(

Access to XMLHttpRequest at 'http://192.168.1.2:8123/api/history/period/2022-06-20T17:35:17.453Z?end_time=2022-06-21T17:35:17.453Z&filter_entity_id=sensor.xiaomi_rack_temperature' from origin 'http://192.168.1.2:1717' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.

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

No branches or pull requests

3 participants