Repeated "Not Connected" toast message when running behind reverse proxy

First off, this is the best piece of software I’ve used for viewing family photos, so thank you!

I’m running PS Server v2.1.0-alpha.7 on Rocky Linux 9…I had switched to the Alpha version to workaround the ffmpeg “singlejpeg” bug.

When running Photostructure behind a reverse proxy (in my case, Apache), a “Not Connected (we’ll retry in a bit)” toast notification appears every 60 seconds.

If I increase Apache’s ProxyTimeout from 60 to 120, then the message appears every 120 seconds. So I can reduce the frequency of the message, but it’s still a bit distracting.

Looking at the Network inspector in the browser, I believe the /updates endpoint uses long polling, and the reverse proxy is closing the long-held connection when the timeout is reached.

As a workaround, you can set ProxyTimeout to a huge value, but this kinda goes against the spirit of how Apache designed their reverse proxying to work.

Expected Behavior

It’s my understanding that most reverse proxies do not hold standard HTTP connections open indefinitely. When running behind a reverse proxy, I would expect Photostructure to silently reopen the connection to the /updates endpoint and only show the toast notification when the reconnection fails.

Current Behavior

When running behind an Apache reverse proxy, a repeated toast notification is displayed on an interval corresponding to the server’s ProxyTimeout value.

Steps to Reproduce

  1. Run Photostructure behind an Apache reverse proxy, configured like so:
<VirtualHost *:443>
  DocumentRoot "/var/www/html"

  SSLEngine on
  SSLCertificateFile /etc/pki/tls/certs/cert.pem
  SSLCertificateKeyFile /etc/pki/tls/private/cert.key

 # ProxyTimeout 60 (the default)

  ProxyRequests Off
  ProxyPreserveHost On
  ProxyPass / 
  ProxyPassReverse /
  RequestHeader set X-Forwarded-Proto "https"
  RequestHeader set X-Real-IP %{REMOTE_ADDR}e

  <Directory "/var/www/html">
     AllowOverride None
    Require all granted

  1. Open the Photostructure application in a web browser

  2. Watch the notification appear every 60 seconds (or whatever value you configured for ProxyTimeout).


Rocky Linux 9 x86_64
Apache reverse proxy
Photostructure for Node v2.1.0-alpha.7

Howdy, @dixielinux , welcome to PhotoStructure!

I believe I know what’s going on.

The progress panels on the home page (.../tags) are updated via Server-sent events, which holds a socket open to the server.

Apache is destroying this socket, which the frontend detects (as an .onerror event) and throws up the “Not connected” error.

Perhaps it’s OK to just not render this error? When this happens, PhotoStructure tries periodically to restore the socket, so it should “auto-heal.” I’ll delete the toast from showing on .onerrors in the next alpha build.

Thanks for taking the time to explain your setup and the error so clearly! :100:


Thanks for replying so quickly!

I can indeed see from the devtools that the connection automatically reestablishes itself after the timeout. So there appears to be no real problem except for the notification.

Excellent. I think just omitting the toast should be safe, then. I’ll try to get that build out soon.

Cheers :beers: