svenstaro/miniserve

CSS not working when root domain not accessible

Opened this issue · 0 comments

Hello,

Description

I am trying to create a miniserve with basicauth by path, for example :

  • url.com/toto => basicauth user:a password:a
  • url.com/titi => basicauth user:b password:b

But

  • url.com/ => should not be accessible

Problem

The CSS do not work as it try to get it from "url.com/CSS" but the access to "url.com/" is denied

How to repro

Here how I am doing with traefik :

Spoiler
labels:
# service
traefik.enable: "true"
traefik.http.services.miniserve.loadbalancer.server.port: "8080"

# test
traefik.http.routers.miniserve-test.rule: "Host(`url.com`) && PathPrefix(`/test`)"
traefik.http.routers.miniserve-test.tls: "true"
traefik.http.routers.miniserve-test.entrypoints: "web-secure"
traefik.http.routers.miniserve-test.service: "miniserve"
traefik.http.routers.miniserve-test.middlewares: "miniserve-test-auth, contentCompression@file, autodetectContenttype@file"
traefik.http.middlewares.miniserve-test-auth.basicauth.removeheader: true
traefik.http.middlewares.miniserve-test-auth.basicauth.users: "..."

# toto
traefik.http.routers.miniserve-toto.rule: "Host(`url.com`) && PathPrefix(`/toto`)"
traefik.http.routers.miniserve-toto.tls: "true"
traefik.http.routers.miniserve-toto.entrypoints: "web-secure"
traefik.http.routers.miniserve-toto.service: "miniserve"
traefik.http.routers.miniserve-toto.middlewares: "miniserve-toto-auth, contentCompression@file, autodetectContenttype@file"
traefik.http.middlewares.miniserve-toto-auth.basicauth.removeheader: true
traefik.http.middlewares.miniserve-toto-auth.basicauth.users: "..."

Possible solution

Is there a way to make the css file accessible to all path even if the / is not accessible ?
Like having the CSS in relative path ?

Thanks in advance,
BrandonFL