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

  1. Crete user and protect it with password
  2. Visit https://DOMAIN/heimdallExternal/ and see Login page grafik
  3. 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 of location: https://DOMAIN/heimdallExternal/
  4. Workaround - visit again https://DOMAIN/heimdallExternal/.

2. SOLVED - Wrong Link by editing Order

  1. Visit https://DOMAIN/heimdallExternal/ and change order of TABs
  2. Save and see that after page reloading nothing saved and defaults (initial) state been shown
  3. Root Cause:
    • Order Endpoint ignores Settings, instead doing POST on https://DOMAIN/heimdallExternal/order it does on endpoint without / between sub path and order endpoint: https://DOMAIN/heimdallExternalorder.
    • Even more it ignores APP_URL configuration from .env and expect POST on http://localhost:9012/order instead of http://localhost:9012/heimdallExternal/order
  4. 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

  1. Visit https://DOMAIN/heimdallExternal/ and change your background Image
  2. Standard image will be shown
  3. Root Cause:
    • Image Endpoint ignores Settings, instead of doing GET on https://DOMAIN/heimdallExternal/storage/... it does on endpoint endpoint: https://DOMAIN/storage/....
  4. 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

  1. Visit https://DOMAIN/heimdallExternal/ and change your pins on the left panel
  2. Nothing will happens
  3. Root Cause:
    • Endpoint ignores Settings, instead of doing GET on https://DOMAIN/heimdallExternal/items/... it does on endpoint endpoint: https://DOMAIN/heimdallExternalitems/....
  4. 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)

Most upvoted comments

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 like APP_URL="${VARIABLE_APP_URL}" to make it configurable in .env file.

I have a similar setup to you and experience some of your issues.

# Config for Heimdall in Apache2
<Location /home>
  ProxyPass http://localhost:8001
  ProxyPassReverse /home
  RequestHeader set X-Forwarded-Proto "https"
</Location>

I fixed your issues 2, 3, 4 by adding a / add the end of the APP_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.