Skip to content

Fallback for multiple subdirectories #56

@stephanrenggli

Description

@stephanrenggli

I use goStatic in a docker/traefik setup where goStatic serves as errorpages and a catch-all. So any route that isn't matched by traefik will get routed to goStatic. The setup works well.

Traefik will handle: doesnotexist.example.com
The goStatic fallback will handle: doesnotexist.example.com/doesnotexist

The only case which currently isn't being handled nicely is: doesnotexist.example.com/doesnotexist/doesnotexist (or even more subdirs).
If there are multiple subdirectories the html page will be shown, but any css/js/images will fail to load.

Refused to apply style from 'https://doesnotexist.example.com/doesnotexist/css/404.css' because its MIME type ('text/html') is not a supported stylesheet MIME type, and strict MIME checking is enabled.
Refused to execute script from 'https://doesnotexist.example.com/doesnotexist/js/tsparticles.bundle.min.js' because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled.
Refused to execute script from 'https://doesnotexist.example.com/doesnotexist/js/404.js' because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled.
Refused to apply style from 'https://doesnotexist.example.com/doesnotexist/css/404.css' because its MIME type ('text/html') is not a supported stylesheet MIME type, and strict MIME checking is enabled.

I have tried both setting -fallback /index.html and -fallback index.html, the result seems to be the same.
My file structure inside the container looks as follows:

/srv/
├─ http/
│  ├─ css/
│  │  ├─ 404.css
│  ├─ images/
│  │  ├─ image.svg
│  ├─ js/
│  │  ├─ 404.js
│  │  ├─ tsparticles.bundle.min.js
│  ├─ index.html

Is there a way to redirect all requests to a specified path and not just one level of subdirectories?
Am I missing something else?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions