NHAS / wag

Simple Wireguard 2FA
BSD 3-Clause "New" or "Revised" License
486 stars 27 forks source link

Custom templates not working #76

Closed bluecraank closed 6 months ago

bluecraank commented 8 months ago

Hello,

i try to access my custom css and javascript.

https://server.com/custom/custom_style.css "404 page not found"

Filestructure:

templates

config.json

"MFATemplatesDirectory": "templates"

Whats is wrong?

NHAS commented 8 months ago

Ah thats quite frustrating, it seems i've forgotten to strip the path prefix when using FileServer

        fs := http.FileServer(http.Dir(path.Join(config.Values().MFATemplatesDirectory, "static")))
        tunnel.Handle("/custom/", fs)

Should be:

        fs := http.FileServer(http.Dir(path.Join(config.Values().MFATemplatesDirectory, "static")))
        tunnel.Handle("/custom/", http.StripPrefix("/custom/", fs))
NHAS commented 8 months ago

As a temporary work around I think if you make your path:

"MFATemplatesDirectory": "templates"

With the structure:

templates/custom/static/

It should work, but I'll change that to be more logical

bluecraank commented 8 months ago

But your workaround seems not to work. Need to wait for your new wag build on master

bluecraank commented 7 months ago

Works!