Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Webassets are not loaded when X-Script-Name is set #251

Open
wolkenschieber opened this issue Mar 12, 2023 · 3 comments
Open

[BUG] Webassets are not loaded when X-Script-Name is set #251

wolkenschieber opened this issue Mar 12, 2023 · 3 comments
Labels

Comments

@wolkenschieber
Copy link

Describe the bug

Webassets are not loaed, when a custom path through X-Script-Name is set.

Container Details

My compose file looks like:

version: '3.9'

services:
  octoprint:
    labels:
      - "traefik.enable=true"
      - "traefik.docker.network=proxy"
      - "traefik.http.routers.octoprint.entrypoints=web"
      - "traefik.http.routers.octoprint.rule=PathPrefix(`/octoprint`)"
      - "traefik.http.services.octoprint.loadbalancer.server.port=80"
      - "traefik.http.middlewares.opPathHeader.headers.customrequestheaders.X-Script-Name=/octoprint"
      - "traefik.http.routers.octoprint.middlewares=opPathHeader@docker"
    image: octoprint/octoprint
    restart: unless-stopped
    volumes:
     - ./config:/octoprint
    networks:
     - proxy

networks:
  proxy:
    external: true

To Reproduce

Navigate to http://SERVER/octoprint/. The page won't load. File from static/webassets report 404.

Screenshots

image

@shotor
Copy link

shotor commented Nov 4, 2023

I had the same issue. Came here to ask for more attention to this issue. But then I noticed a typo in my config.

In any case, to fix this issue you also need to strip the /octoprint prefix and add the X-Scheme header if you're using https. I'll add this to the community FAQ as well.

labels:
  - "traefik.http.middlewares.octoprint-headers.headers.customrequestheaders.X-Script-Name=/octoprint"
  - "traefik.http.middlewares.octoprint-headers.headers.customrequestheaders.X-Scheme=https"
  - "traefik.http.middlewares.octoprint-strip-prefix.stripprefix.prefixes=/octoprint"
  - "traefik.http.routers.octoprint.middlewares=octoprint-headers,octoprint-strip-prefix"

@Lan-Hekary
Copy link

I have the same bug when I try to use it with the Path Prefix, is there a solution for it yet?

@shotor
Copy link

shotor commented May 23, 2024

I have the same bug when I try to use it with the Path Prefix, is there a solution for it yet?

Try:

labels:
  - "traefik.http.middlewares.octoprint-headers.headers.customrequestheaders.X-Script-Name=/octoprint"
  - "traefik.http.middlewares.octoprint-headers.headers.customrequestheaders.X-Scheme=https"
  - "traefik.http.middlewares.octoprint-strip-prefix.stripprefix.prefixes=/octoprint"
  - "traefik.http.routers.octoprint.middlewares=octoprint-headers,octoprint-strip-prefix"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants