Cloudflare Tunnel

Hi, I am running immich on my server at home and i am using the cloudflare zero-trust tunnel to access it remotely from my phone. I got a tunnel set up, with which I can reach immich over the tunnel.domain.com address from outside my network. From the app however it says, that i used wrong password/username/domain. I can however connect from my local network over the IP of the proxy container. I set the tunnel up, that it points the immich.domain.com address to the proxy container. Is there something I am missing? I tried so many things, but nothing worked.
53 Replies
bo0tzz
bo0tzz3y ago
Did you add /api to the address when entering it in the app?
dettoman
dettomanOP3y ago
yes. When i am on my phone and I go to immich.domain.com/api/server-info/ping it returns "pong", but the app will not connect. Maybe does it have something to do with the IMMICH_API_URL_EXTERNAL Variable? It doesnt seem to effect anything. I currently have it set to "http://immich-server:3001". I tried immich.domain.com, but without luck. Maybe could it be some sort of ssl verification problem on the client side?
bo0tzz
bo0tzz3y ago
Unless you have a non-default setup, you shouldn't need to set any of those URL variables It could be ssl, do you have a valid certificate?
dettoman
dettomanOP3y ago
cloudflare takes care of the certificates afaik.
dettoman
dettomanOP3y ago
No description
dettoman
dettomanOP3y ago
i also run nextcloud in the same fashion and there are no certificate issues in their app also browsers never complain about certificate issues
Alex Tran
Alex Tran3y ago
Can you show your redacted .env file?
jrasm91
jrasm913y ago
GitHub
[Feature]: Ability to pass custom headers via mobile apps · Issue #...
Feature detail Hello there 👋 Firstly, I'd like to thank you for such an awesome project. It's incredible how fast it improves with brand-new features! 🚀 Context I set up Immich on m...
dettoman
dettomanOP3y ago
I dont think so. I dont want cloudflare to handle authentication. I just use it to connect a service to a public hostname. usually no headers are required
jrasm91
jrasm913y ago
Ah, got it. Does it work on mobile network (data, no local WAN)? When you connect in the browser do you get a warning about an insecure connection?
dettoman
dettomanOP3y ago
it does work on mobile connection and i get no warning in the mobile browser. I tried it also in a different browser from what i normally use in a private tab.
jrasm91
jrasm913y ago
I mean does login to the app work on mobile data? Or does login always not work?
dettoman
dettomanOP3y ago
Ah, sorry. Yes login also works
jrasm91
jrasm913y ago
So it only doesn't work on your local network via hostname But you can see the website locally via hostname?
dettoman
dettomanOP3y ago
i can log into the app with the local IP. I cannot over the public hostname (regardless of local or mobile connection). I can log into the website in any case
jrasm91
jrasm913y ago
Ok, that seems like it would indicate an ssl issue problem maybe
dettoman
dettomanOP3y ago
How would i investigate that? The app does not show any relevant logs
jrasm91
jrasm913y ago
Similar issue over here: https://discord.com/channels/979116623879368755/1065861485798096936/1065872957689303080 I'd double check it shows everything is good for the certificate on chrome.
dettoman
dettomanOP3y ago
No description
jrasm91
jrasm913y ago
Man everything looks good
dettoman
dettomanOP3y ago
¯\_(ツ)_/¯ I am very clueless
Alex Tran
Alex Tran3y ago
do you selfsign the ssl certificate?
Alex Tran
Alex Tran3y ago
GitHub
[BUG] Cannot access Immich behind HTTPS reverse proxy from Android ...
Describe the bug I run my own CA, and have root certificate installed in trusted store of all of my devices. Reverse proxy (Caddy) obtains certificate from the CA for every subdomain, and this work...
Alex Tran
Alex Tran3y ago
I assume you are using an Android
dettoman
dettomanOP3y ago
yes, using android
Alex Tran
Alex Tran3y ago
how is your certificate handled? self-sign?
dettoman
dettomanOP3y ago
i am not aware of self signing any certificates. the cloudflared service is doing all the https stuff
Alex Tran
Alex Tran3y ago
Got it
dettoman
dettomanOP3y ago
i am just telling cloudflare the local ip of the service. in my case http://localhost:2283 and it makes it available to immich.domain.com
Alex Tran
Alex Tran3y ago
have you tried with an actual IP, not localhost?
dettoman
dettomanOP3y ago
it also works if i tell it my local ip (http://192.168.1.87:2283) Could the problem be, that cloudflare creates a wildcard certificate for the domain like *.domain.com
No description
Alex Tran
Alex Tran3y ago
I am not sure, can we edit/remove the wildcard domain to test?
dettoman
dettomanOP3y ago
AHHHH. I tried a different domain i had laying around. If i use just the base domain - no subdmain, It works and i can log into it from the app This is super weird
Alex Tran
Alex Tran3y ago
Hmm so like domain.com?
dettoman
dettomanOP3y ago
yes
Alex Tran
Alex Tran3y ago
that is weird
dettoman
dettomanOP3y ago
interestingly it is also a wildcard certificate
No description
dettoman
dettomanOP3y ago
but they are from different trust sources left is also a .com domain and on the right is my throwaway .win domain if a use a subdomain on the .win domain, it also works. So it might be a problem with the Google Trust Serivices Certificate?
Alex Tran
Alex Tran3y ago
Yeah since it is the only difference
dettoman
dettomanOP3y ago
Last TLD (.xyz) i own also works from the app
No description
dettoman
dettomanOP3y ago
i am hosting it now from a different domain and everything is fine now. Thanks for the help. I appreciate your work and the support! should i create a ticket on that matter?
Alex Tran
Alex Tran3y ago
I don't see the need yet as this is not related to Immich, you can post in show-and-tell discussion thread on Github
dettoman
dettomanOP3y ago
Maybe its some sort of a problem for the Android App?
Alex Tran
Alex Tran3y ago
I think it might related to how Android handle certificate. https://discord.com/channels/979116623879368755/1065861485798096936 This might solve your problem
mritunjaymusale
Heres how I do it: 1) in the zerotrust app i made a policy that people with their warp app can bypass cloudfalre's authentication 2) then i set a warp login policy that uses their cf's typical way of login 3) after doing this i goto advance settings in my warp and login in using zerotrust and enter all the details after that all my domains are accessible without having to login for each one 4) then in my phone i just enter the public domain which is tunneled which I think OP has setup properly, followed by the auth uname and pass 5) that's it, rest of the app works fine as long as the vpn created by warp is kept online this way people with zero trust login can access the app, for getting access to zerotrust they need to be in approved email list which is policy that you can set on their page
mediaserver1
mediaserver13y ago
Will using Immich with CF tunnel not be violation of their TOS ?
Alex Tran
Alex Tran3y ago
what term would be violated?
mediaserver1
mediaserver13y ago
They have some condition with bandwidth limit for media. Some accounts got banned while using Plex/Emby thru CF tunnel. I assume, the photos and videos upload/download via the tunnel will also b under same category.
Alex Tran
Alex Tran3y ago
good to know
mritunjaymusale
i guess photos aren't hitting as hard as videos do imo that's why i haven't received any emails about my immich causing problems @Alex Tran one more question related to cloudflare does immich have support for those custom headers? as in "service auth tokens" under cloudflare zerotrust Like the app LunaSea does for it's modules
Knight
Knight3y ago
I think what might be happening here is the WAF/Anti-bot/DDoS protection of cloudflare kicking in. Try disabling DDoS protection if you can. https://support.cloudflare.com/hc/en-us/articles/218411427-Is-there-a-tutorial-for-PageRules- Check the cloudflare firewall logs first.
mritunjaymusale
?

Did you find this page helpful?