Heimdall: Reverse Proxy with Apache2 several wrong Endpoints
Solved in https://github.com/linuxserver/Heimdall/issues/768#issuecomment-1830048871
Hello dear community,
I would like to use Heimdall with Apache2 Reverse Proxy as sub path and do create following configuration in it:
#Heimdall
Redirect 301 "/heimdallExternal" "/heimdallExternal/"
<Location /heimdallExternal/>
ProxyPreserveHost On
ProxyPass http://localhost:9012/ retry=0 timeout=5
ProxyPassReverse http://localhost:9012/
RequestHeader set Connection ""
RequestHeader set x-forwarded-proto "https"
</Location>
My docker compose file:
version: "3.6"
services:
heimdallExternal:
image: lscr.io/linuxserver/heimdall
container_name: heimdallExternal
environment:
- PUID=${PUID}
- PGID=${PGID}
- TZ=${TZ}
volumes:
- ${WORKINGDIR}/docker/heimdallExternal/:/config
ports:
- 9012:80
restart: unless-stopped
I did update ..www/.env
so that my hostname with sub path are configured:
APP_NAME=Heimdall
APP_ENV=local
APP_KEY=base64:xxxx
APP_DEBUG=false
APP_URL=https://DOMAIN/heimdallExternal
...
After that I’m able to use Heimdall under https://DOMAIN/heimdallExternal/
.
Unfortunately it has few issues:
1. Wrong Redirect after login
- Crete user and protect it with password
- Visit
https://DOMAIN/heimdallExternal/
and see Login page - Enter password and Hit enter --> See an error page or wrong Page not Heimdall any more.
- Open Network inspector and see correct POST request.
- After it comes GET with wrong answer in header
location: https://DOMAIN
instead oflocation: https://DOMAIN/heimdallExternal/
- Workaround - visit again
https://DOMAIN/heimdallExternal/
.
2. SOLVED - Wrong Link by editing Order
- Visit
https://DOMAIN/heimdallExternal/
and change order of TABs - Save and see that after page reloading nothing saved and defaults (initial) state been shown
- Root Cause:
- Order Endpoint ignores Settings, instead doing POST on
https://DOMAIN/heimdallExternal/order
it does on endpoint without/
between sub path andorder
endpoint:https://DOMAIN/heimdallExternalorder
. - Even more it ignores
APP_URL
configuration from.env
and expect POST onhttp://localhost:9012/order
instead ofhttp://localhost:9012/heimdallExternal/order
- Order Endpoint ignores Settings, instead doing POST on
- Workaround - add rewrite rule to the Apache2 Server:
# You have to merge "order" and your sub path to "subPathorder"
<Location /heimdallExternalorder>
ProxyPreserveHost On
ProxyPass http://localhost:9012/order retry=0 timeout=5
ProxyPassReverse http://localhost:9012/order
RequestHeader set Connection ""
RequestHeader set x-forwarded-proto "https"
</Location>
3. SOLVED - Background Image wrong URL
- Visit
https://DOMAIN/heimdallExternal/
and change your background Image - Standard image will be shown
- Root Cause:
- Image Endpoint ignores Settings, instead of doing GET on
https://DOMAIN/heimdallExternal/storage/...
it does on endpoint endpoint:https://DOMAIN/storage/...
.
- Image Endpoint ignores Settings, instead of doing GET on
- Workaround - add rewrite rule to the Apache2 Server:
<Location /storage/>
ProxyPreserveHost On
ProxyPass http://localhost:9012/storage/ retry=0 timeout=5
ProxyPassReverse http://localhost:9012/storage/
RequestHeader set Connection ""
RequestHeader set x-forwarded-proto "https"
</Location>
4. SOLVED - Wrong link by editing Pins
- Visit
https://DOMAIN/heimdallExternal/
and change your pins on the left panel - Nothing will happens
- Root Cause:
- Endpoint ignores Settings, instead of doing GET on
https://DOMAIN/heimdallExternal/items/...
it does on endpoint endpoint:https://DOMAIN/heimdallExternalitems/...
.
- Endpoint ignores Settings, instead of doing GET on
- Workaround - add rewrite rule to the Apache2 Server:
<Location /heimdallExternalitems/>
ProxyPreserveHost On
ProxyPass http://localhost:9012/items/ retry=0 timeout=5
ProxyPassReverse http://localhost:9012/items/
RequestHeader set Connection ""
RequestHeader set x-forwarded-proto "https"
</Location>
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 19 (2 by maintainers)
Thats cool, thanks! Than we can close 2,3,4. Only 1 is remaining 😄
I would also suggest to replace
APP_URL=https://FQDN/blabla
with something likeAPP_URL="${VARIABLE_APP_URL}"
to make it configurable in.env
file.I have a similar setup to you and experience some of your issues.
I fixed your issues 2, 3, 4 by adding a
/
add the end of theAPP_URL
value, i.e.APP_URL=https://my.domain/home/
. However, I’m still experiencing the wrong redirect after login.In addition, the autofill features with the “Application Type” and “Website” buttons in
/items/create
don’t work when going through the proxy.