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
Unable to access through nginx reverse proxy - stuck at "Your Home Gallery is loading..." #112
Comments
Hi @JohanE67 thank you for rising this issue. The gallery is a Single Page Application (SPA) with URL based routing. So To fix that the server command has a appropriate parameter
With your docker setup you can add an environment variable When the base path is set you need to access the gallery always below |
So, I added the When I now go to When I go to
However, now the initial page is shown, not the year. Also, the url in the address bar switches back to plain So it looks like the base-path directive is getting ignored?? |
Hi @JohanE67 I've checked a simple example ant it seems that Here is my working configuration:
|
after lots and lots and LOTS of trying, I cannot for the life of me get this to work. I'm using homegallery through docker with my own local API instance. Reverse Proxy is handled by Caddy, though in my testing I found that issues also arise when accessing the service directly via IP:3000. Configuration is done via the server:
#port: 3000
#host: '0.0.0.0'
# security configuration for https
# key: '{configDir}/server.key'
# cert: '{configDir}/server.crt'
#openBrowser: true
basePath: /gallery/
watchSources: true I have not found a way to confirm that the container is properly loading this configuration, but reading the file from a shell inside the container shows the correct settings. I have also not found a way to read the HTTP access logs of the app. But I have the access logs from my browser, when accessing the website with this config (presumably) loaded. When loading
This looks promising, but something in the JS must not properly load the following required ressources, so I get stuck on the loadscreen. When loading
In the entire list, I cannot find a single entry that was loaded from /gallery/. Not the images, not the static files, not the API calls. It all comes from the root, where I cannot even make contact when directly loading it. How can this be? I've spent hours trying to fix it, but cannot pinpoint the source of the issue. Note that whenever testing this, the cache was disabled through the developer tools, so I am discarding "cached file locations" or anything of the sort as a possible root. Thanks in advance for any help you can provide. |
Hi @bytebone thank you for your input and your patience so far. I am sorry that is was not successful until now.
I try to reproduce your setting. For your comment it is not 100% clear how your setup is created. So HomeGallery server, local API and Caddy are running inside docker via docker compose? I would like to reproduce this setting with Caddy - never played around with Caddy but heard it should be awesome. Would you mind to provide your Can you reproduce my previous provided
You can only serve the server with one defined base path. Either If you use a base path the Browser sends a request with I tested the http proxy settings via curl and checked if the response is correct. If you provide your
In the mounted
|
Thank you for the elaborate and prompt response.
This, combined with the reminder that when using a base path I kind of have to access the app through the reverse proxy instead of the local IP, gave me the "click" i needed to make it work. I've updated my Caddyfile to remove the basePath before handing requests to the app, and voilá! It works. I'll still try to answer your questions as best as I can:
I've run NPM (nginx spinoff) for a while and am unhappy with the high memory usage. plus, caddy has been on my list of things to try for a while, so this second server of mine is the perfect playground to do so.
Home Gallery App and API, as well as Caddy are all running on Docker. The two HG services are in one "HG-exclusive" network, the frontend app additionally joins the existing, Caddy-managed caddy network. compose.yml: version: "3.9"
services:
api:
image: xemle/home-gallery-api-server
container_name: homegallery-api
environment:
- BACKEND=node
networks:
- internal
app:
image: xemle/home-gallery
container_name: homegallery-app
environment:
- GALLERY_API_SERVER=http://api:3000
- GALLERY_API_SERVER_CONCURRENT=5 # for SoC devices like Rasperry Pi. Use 5 otherwise
- GALLERY_API_SERVER_TIMEOUT=30 # for SoC devices like Rasperry Pi. Use 30 otherwise
- GALLERY_OPEN_BROWSER=false
- GALLERY_WATCH_POLL_INTERVAL=0
volumes:
- /mnt/user/appdata/homegallery:/data
- /mnt/user/pictures1:/data/pictures/source1:ro
- /mnt/user/pictures2:/data/pictures/source2:ro
ports:
- "3000:3000"
networks:
- internal
- caddy
entrypoint: ['node', '/app/gallery.js']
command: ['run', 'server']
networks:
internal:
name: hg_internal
caddy:
external: true Caddyfile (before fixing it as described above):
To fix the issue, replace the (Sidenote: Caddy hands all traffic to a Cloudflare tunnel, which handles SSL encryption at the CF edge, which is why I'm completely skipping encryption on my server) Also good to know that this gallery.log has the access logs. I saw it plenty of times when editing the config, but never had the thought to actually look inside. |
Hi @bytebone I am very happy than you were able to solve your problem. Thank you for sharing your insights. Have fun with your digital memories! |
Unfortunately, I'm still unable to get it to work. Even using the nginx proxy setup you provided, I'm getting only the login form and then the "Your Home Gallery is loading..." page. Could be something in the "swag" setup I'm using, but I'm unable to figure out what it is... One thing I notice in the logs is that, upon a request through the proxy I now get this:
So it looks as if the calls are being made, but without the items to "GET". |
Hi @JohanE67 I am sorry that your setup is not working yet. Would you mind to provide your configs of ningx, docker compose and your gallery.config.yml with the required sections for the gallery server? In your first post you have the nginx location directive:
Maybe the
If all requests lead to a You can check your settings by a browser to call
|
As I mentioned in the first post, I'm using the LinuxServer/Swag container. The main nginx config is this:
The site config, that is included in the above file (
The proxy configs are included via the file above. For home gallery I created
So I changed 301 to 307 in So I think that basically, I have the same setup as you. Still it's not working. When I try the call to
|
Adding the trailing slash fixed the issue for me. Documentation should be updated i think... Just put an example in the YML file with the training slash would be enough. My NGINX config is:
and in the config yml i have
|
I am running home gallery in a docker container setup and within my network it's all working as expected.
Now, for remote access, I am attempting to add home gallery to my remote proxy setup that I have running for several other web apps. I can see that the proxying is working, in a sense that the requests arrive at the home-gallery container. However, it stops at the initial "GET" request and nothing ever appears in the browser but the black screen with the house and text "Your Home Gallery is loading...".
Here's my docker-compose.yml:
And here's the relevant proxy setup (this is using the LinuxServer/Swag container. Filename "proxy-confs/homegallery.subfolder.conf":
When looking in the home-gallery container log, when attempting to open the gallery from the local network (http://192.168.1.10:3030) I see this:
And the photostream appears in the browser.
When going through the reverse proxy (https://[my-domain]/homegallery/), I see only this:
[2024-01-04 14:15:33.587]: server.request 200 GET / 37ms
And am stuck at the "loading..." page.
The "rewrite" in the proxy conf appears to be working correctly, for when I retrieve a specific year for example (https://[my-domain]/homegallery/years/2015), I will see this in the log:
[2024-01-04 14:19:56.539]: server.request 304 GET /years/2015 10ms
And then nothing ... While this works fine when running on the local network.
I hope someone can give a hint on where this is going wrong.
Thanks,
Johan
The text was updated successfully, but these errors were encountered: