Run Headlamp with a base-url

    Normally Headlamp runs at the root of the domain. Hower you can also ask to run it at a base-url like “/headlamp” for example.

    • default at the root of the domain: https://headlamp.example.com/.
    • base-url https://example.com/headlamp/

    A warning about multiple apps on the same sub domain

    Hosting multiple websites (apps) on the same origin can lead to possible conflicts between the apps. Each app is able to access information and make requests of the other. Therefore each app needs to be tested together, trusted, and a compatible Content-Security-Policy should be considered for each of them.

    If in doubt, host Headlamp on a separate origin (domain or port, don’t use the -base-url option).

    How to use with a base-url

    Dev mode

    ./backend/headlamp-server -dev -base-url /headlamp
    PUBLIC_URL="/headlamp" make run-frontend
    

    Then go to http://localhost:3000/headlamp/ in your browser.

    Static build mode

    cd frontend && npm install && npm run build && cd ..
    ./backend/headlamp-server -dev -base-url /headlamp -html-static-dir frontend/build
    

    Then go to http://localhost:4466/headlamp/ in your browser.

    Docker mode

    Append --base-url /headlamp to the docker run command. Note the extra “-”.

    Kubernetes

    You can modify your kubernetes deployment file to add -base-url /headlamp to the containers args.

            args:
              - "-in-cluster"
              - "-plugins-dir=/headlamp/plugins"
              - "-base-url=/headlamp"