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

CORS policy !! #4

Closed
sigalou opened this issue May 5, 2024 · 1 comment
Closed

CORS policy !! #4

sigalou opened this issue May 5, 2024 · 1 comment

Comments

@sigalou
Copy link

sigalou commented May 5, 2024

Hi !!

Access to fetch at 'http://192.168.1.2:2283/api/asset/random' from origin 'http://homeassistant.local:8123' 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. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.

I have worked a lot to try to understand my problem but I still have a blockage.
I even tried putting nginx as a reverse proxy server to add Access-Control-Allow-Origin, nothing worked. Requests like /api/asset/random work fine with postman but not with Home Assistant.
The fetch is systematically in error.

I have the right API socket, I have the right address, the right port. When I do the same query as fetch in Postma, it works. When I do it in curl in cli, same, it's ok

I tested other requests that respond in json, they work well, only those sent to immit are blocked.
I don't understand, do you have a card that works?

thank!

@mulder82
Copy link
Owner

mulder82 commented May 6, 2024

Hi,

I had identical problems while creating this add-on. The solutions are two:

  1. Modify the immich server to send the appropriate HTTP CORS headers

  2. Run chromium browser with the appropriate parameters so that it does not check the cors rules:

chromium-browser --disable-web-security --user-data-dir=“[some directory here]”

I personally use the latter option and everything works very stably.

My command to run chromium in kiosk mode look like this:

/usr/bin/chromium-browser --noerrdialogs --disable-infobars --ignore-certificate-errors --allow-running-insecure-content --disable-web-security --user-data-dir=/home/sadm/kiosk/chrome-profile --kiosk https://192.168.1.100:8123/dashboard-verbatim/home?kiosk

@mulder82 mulder82 closed this as completed Jun 2, 2024
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

2 participants