Closed Frankenberrypi closed 10 months ago
You're correct.
You will need to put a reverse proxy in front of Immich adding the CORS headers outlined in the readme, otherwise immich-duplicates won't be able to make API calls to Immich.
Ah, ok, I misunderstood then. I am already running an nginx reverse proxy. Does the nginx code from step 4 go in the custom nginx configuration field?
I don't think you misunderstood. In earlier versions of Immich, when they still used nginx you could patch immich's nginx config directly, regardless of any extra reverse proxy in front of the immich's nginx.
Since you have nginx in front of immich's new web server, find the /api
location (if you don't have it, use /
) and add those add_header
lines.
You can check if your settings work if the duplicate browser works. Otherwise you'll see errors related to CORS in your browser's developer tools.
Unfortunately I don't know what you mean by "custom nginx configuration field".
To clarify, I am using NPM, https://nginxproxymanager.com/
find the /api location (if you don't have it, use /) and add those add_header lines.
Probably showing my ignorance here, do you mean somewhere in the file system of the nginx container, or in a config file? When I said "custom nginx configuration field", I was referring to the proxy host edit form for the NPM web configuration. It also has a "Custom Locations" field. I may be in a bit over my head.
OK, understood. I think I'm not going to fiddle with your proxy manager and I don't want you to fiddle with its config as well.
Can you please have a look at c3c6cf7 and see if the updated instructions help?
The idea is this:
localhost
to Immich on your server, which runs on a different domain (e.g. immich.example.com
)immich.example.com
tells your browser it's OK to make these requests via CORS headers your browser will refuse to make those requests (because it crosses the localhost
origin)OK, your explanation makes sense to me, but I'm still having a little trouble implementing it based on the new instructions. Where exactly are these commands entered?
$ cd immich-cors-proxy
$ ./run https://immich.example.com/
My first attempts were in the command prompt after the docker container for the browser started up, like this:
That does not seem to have been successful. I am able to navigate to the browser, but get these errors after entering the information on the setup page and clicking OK.
I also connected to the running container and rooted around for the immich-cors-proxy directory, but couldn't find it.
Where exactly are these commands entered?
You need to download this repo to your local machine, either using git or download and extract the zip file. For the git or zip address click on the green button labeled "Code" on the top right of this page.
Then enter the directory containing the git clone (or the extracted zip) and run cd
and run
from the README.
agross@firiel ~
$ git clone https://github.com/agross/immich-duplicates.git
Cloning into 'immich-duplicates'...
remote: Enumerating objects: 280, done.
remote: Counting objects: 100% (74/74), done.
remote: Compressing objects: 100% (56/56), done.
remote: Total 280 (delta 37), reused 32 (delta 13), pack-reused 206
Receiving objects: 100% (280/280), 568.60 KiB | 6.39 MiB/s, done.
Resolving deltas: 100% (140/140), done.
agross@firiel ~
$ cd immich-duplicates
agross@firiel ~/immich-duplicates master
$ cd immich-cors-proxy
agross@firiel ~/immich-duplicates/immich-cors-proxy master
$ ./run https://photos.therightstuff.de
[+] Running 1/1
✔ Container immich-cors-proxy-traefik-1 Recreated 0.1s
Attaching to traefik-1
traefik-1 | time="2023-12-16T17:26:40Z" level=info msg="Configuration loaded from file: /etc/traefik/traefik.yml"
...
Then try again to open the duplicate-browser as before. It appears to point to the correct http://localhost:8081/api
address already.
My first attempts were in the command prompt after the docker container for the browser started up, like this:
Just for your understanding: The duplicates-browser container never saw what you entered (cd
etc.).
This container does not run with standard input nor a TTY attached (normally enabled by the -it
argument to docker
commands), so while you saw what you entered echoed by your shell the container did not receive it. The duplicate-browser cannot forward requests elsewhere, so you could not find any trace of immich-cors-proxy
in the container's file system.
Ah ha! Success! I knew I was doing something wrong, but didn't have enough background to put together what I was missing. Thank you so much for all the help.
I may submit a pull request in a few days with a few ideas on how to clarify the instructions for someone like me if you're interested in that. Gotta go learn how to do a pull request first though.
I'm working on a simpler solution without an additional container. I'll let you know. I would be grateful if you would test the new variant and provide feedback.
OK, the new variant is up. Please update the docker image of the browser:
$ docker pull ghcr.io/agross/immich-duplicates-browser
You can stop and remove the CORS proxy container.
The new invocation to start the duplicates-browser is this:
$ docker container run \
--env IMMICH_URL=https://immich.example.com \
--rm \
--publish 8080:80 \
ghcr.io/agross/immich-duplicates-browser
Replace https://immich.example.com
accordingly.
After the container is up, visit the Setup screen and
http://localhost:8080/api
(there's a link that sets it for you)If the Setup screen does not include both fields, refresh the page (Ctrl + F5).
These are the changes to the README after removing the "old" CORS proxy that I added earlier today:
I just tried the new method and it works for me. Only 2595 duplicates to go!
Excellent. You can get rid of the git clone as well, forgot that in the earlier reply.
Have fun working through your dupes (I only had ~1000) and please let me know if the readme is good now.
The link in step 4 of the readme doesn't work. https://github.com/immich-app/immich/blob/main/nginx/templates/default.conf.template#L61
Maybe this is related to Immich release 1.88 where they got rid of the immich-web and immich-proxy containers.