mirror of
https://github.com/harness/drone.git
synced 2025-05-08 11:41:25 +08:00
CODE-688: All static assets must be served from the root path
This commit is contained in:
parent
2b6e75682d
commit
a8b48d228d
@ -11,6 +11,7 @@ import (
|
||||
"io/fs"
|
||||
"net/http"
|
||||
"os"
|
||||
"path"
|
||||
"path/filepath"
|
||||
"time"
|
||||
|
||||
@ -36,6 +37,7 @@ func Handler() http.HandlerFunc {
|
||||
// http.FileServer to always load the index.html
|
||||
// file if a directory path is being requested.
|
||||
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
// because this is a single page application,
|
||||
// we need to always load the index.html file
|
||||
// in the root of the project, unless the path
|
||||
@ -44,6 +46,9 @@ func Handler() http.HandlerFunc {
|
||||
// HACK: alter the path to point to the
|
||||
// root of the project.
|
||||
r.URL.Path = "/"
|
||||
} else {
|
||||
// All static assets are served from the root path
|
||||
r.URL.Path = "/" + path.Base(r.URL.Path)
|
||||
}
|
||||
|
||||
// Disable caching and sniffing via HTTP headers for UI main entry resources
|
||||
|
Loading…
Reference in New Issue
Block a user