sbs20 / scanservjs

SANE scanner nodejs web ui
https://sbs20.github.io/scanservjs/
GNU General Public License v2.0
686 stars 137 forks source link

Apache2 Reverse Proxy no longer working - 404 when accessing /Assets #690

Closed skooj closed 7 months ago

skooj commented 7 months ago

Describe the bug I am, and have been, using an Apache2 reverse proxy to access this, following the configuration in the documentation. This worked fine prior to updating to 3.0.2, but now I'm getting a white screen. The app loads as expected when connecting to the port directly.

In dev tools, I am getting the errors:

GET http://XXX.XXX/assets/index-133c69ed.js net::ERR_ABORTED 404 (Not Found)
GET http://XXX.XXX/assets/index-3117738e.css net::ERR_ABORTED 404 (Not Found)

This indicates that /assets/ is not being put behind /scanner/assets as expected. I believe this is a similar issue to #250 which looks like it was maybe fixed with #266

To Reproduce Steps to reproduce the behavior:

  1. install scanservJs (via docker, in my case).
  2. setup apache2 reverse proxy following directions here.
  3. access ScanservJs from /scanner/
  4. open dev tools and refresh
  5. check console for errors

Expected behavior /assets/ would be proxied like everything else.

Client (please complete the following information):

Server (please complete the following information):

Logs

GET http://XXX.XXX/assets/index-133c69ed.js net::ERR_ABORTED 404 (Not Found)
GET http://XXX.XXX/assets/index-3117738e.css net::ERR_ABORTED 404 (Not Found)

Additional context My apache config:

<Location /scanner/>
        ProxyPass "http://0.0.0.0:8088/"
        ProxyPassReverse "http://0.0.0.0:8088/"
</Location>

I have docker forwarding the port 8088 to 8080 instead, because I use 8080 for other things. I have temporarily moved it to 8080 (and updated the config) to see if this fixed the issue, but it did not. Again, this was functioning in the 2.x version, but not since updating to 3.x

Edit: adding the following inside allows it to work, but is likely not what is expected by the project:

AddOutputFilterByType SUBSTITUTE text/html
Substitute "s|assets/|scanner/assets/|ni"
sbs20 commented 7 months ago

Thanks for finding, reporting and the workaround.

I'll have a patch soon

sbs20 commented 7 months ago

I'm holding off doing another proper release just yet, though I'm sure there will be one within a week or so.

GitHub should build a new staging image for docker tonight which should resolve this.

skooj commented 7 months ago

Thank you for the quick fix!