fix für lokale dateien
All checks were successful
release-tag / release-image (push) Successful in 1m55s
All checks were successful
release-tag / release-image (push) Successful in 1m55s
This commit is contained in:
@@ -42,10 +42,20 @@ func main() {
|
||||
r := chi.NewRouter()
|
||||
r.Use(func(next http.Handler) http.Handler {
|
||||
return http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) {
|
||||
w.Header().Set("Content-Security-Policy",
|
||||
strings.Join([]string{
|
||||
"default-src 'self'",
|
||||
"img-src 'self' data:",
|
||||
"style-src 'self'",
|
||||
"font-src 'self'",
|
||||
"script-src 'self'",
|
||||
"connect-src 'self'",
|
||||
// optional: "media-src 'self'",
|
||||
}, "; "),
|
||||
)
|
||||
w.Header().Set("X-Content-Type-Options", "nosniff")
|
||||
w.Header().Set("X-Frame-Options", "SAMEORIGIN")
|
||||
w.Header().Set("Referrer-Policy", "no-referrer")
|
||||
w.Header().Set("Content-Security-Policy", "default-src 'self'; img-src 'self' data:; style-src 'self' https://fonts.googleapis.com 'unsafe-inline'; font-src https://fonts.gstatic.com; script-src 'self' https://cdn.jsdelivr.net")
|
||||
next.ServeHTTP(w, req)
|
||||
})
|
||||
})
|
||||
@@ -82,6 +92,11 @@ func main() {
|
||||
proxy.ErrorHandler = func(w http.ResponseWriter, r *http.Request, e error) {
|
||||
http.Error(w, "upstream error", http.StatusBadGateway)
|
||||
}
|
||||
|
||||
r.Handle("/static/*", http.StripPrefix("/static",
|
||||
http.FileServer(http.FS(ui.FS)),
|
||||
))
|
||||
|
||||
r.Handle("/hls/*", http.StripPrefix("/hls", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
if strings.Contains(r.URL.Path, "..") {
|
||||
http.NotFound(w, r)
|
||||
|
||||
Reference in New Issue
Block a user