F43nd1r / Acrarium

A Backend for ACRA written in Kotlin using Spring Boot, Vaadin and MySQL
Apache License 2.0
196 stars 51 forks source link

Standalone setup fails to load login page using Apache (401) #457

Closed incarnadined closed 5 months ago

incarnadined commented 11 months ago

I have followed the instructions for standalone setup in the wiki with release 1.8.1.

I am binding to 127.0.0.1:59248, and then setting RewriteRule "^(.*)$" http://localhost:59248/$1 [P,NE,L,QSA] in my .htaccess configuration to make the locally hosted acrarium accessible over the internet. I have also set server.context-path=https://my.domain.com in ~/.config/acrarium/application.properties.

When I visit https:/my.domain.com, I am redirected to localhost:59248/login which clearly can't connect as I am visiting the site externally to the server. My interpretation was that setting the server.context-path would fix this so that redirects were sent to the correct place but this doesn't seem to be working. Is there some other setting that I am missing, or is this not supported?

The second issue is that when I manually try and visit the login page, it only loads a 'Connection lost' banner at the top of the page, along with three scroll bars as shown below.

image

The console in my browser also shows three 401 errors

vaadin-bundle-6e4dade3b5e2fbe0d76a.cache.js:86     GET https://my.domain.com/?v-r=init&location=login 401
vaadin-bundle-6e4dade3b5e2fbe0d76a.cache.js:86     GET https://my.domain.com/?v-r=init&location=offline-stub.html 401
vaadin-bundle-6e4dade3b5e2fbe0d76a.cache.js:86     GET https://my.domain.com/?v-r=init&location=offline-stub.html 401

When I run with java -jar acrarium-1.8.1.jar I get no log messages relating to this connection, but when I add --trace I get a series of org.springframework.security.access.AccessDeniedException: Access is denied messages (output below)

With the server I am using, I am unable to use docker. I also believe the database credentials are correct as I was getting a different error message until I put them in.

Have I missed some part of the setup, am I trying to interact with the client incorrectly, or is there some other problem?

Output from connection of client until termination: https://pastebin.com/raw/iHLzanx0

F43nd1r commented 11 months ago

I've been running acrarium behind an apache proxy myself (in docker but that shouldn't matter). Maybe this helps?

<VirtualHost *:443>
    ServerName acrarium.mydomain.com
    ProxyPass  / http://localhost:8080/
    ProxyPassReverse / http://localhost:8080/
    ProxyPassReverseCookiePath / /
</VirtualHost>
incarnadined commented 11 months ago

Unfortunately I only have access to the .htaccess in my site's root directory, so none of those configurations are allowed

F43nd1r commented 11 months ago

Try setting vaadin.urlMapping as well

incarnadined commented 11 months ago

The documentation and some stack overflow posts use this to specify some path (e.g. /mapping/).

Do you have a suggestion as to using it to point to the root of a domain (simply writing the domain errors)?

F43nd1r commented 11 months ago

I'm not sure if this can be supported without reverse proxy, doesn't look like vaadin+spring supports it. You could try with latest beta to get Spring Boot 3 and a newer Vaadin version, but not sure if it helps. Or you can ask for help on the Vaadin side.