Compare commits
7 Commits
feat/add-c
...
db9031448b
| Author | SHA1 | Date | |
|---|---|---|---|
| db9031448b | |||
|
|
aa746177e5 | ||
|
|
91da9eb8c7 | ||
|
|
4b2888cb90 | ||
| 78d657111b | |||
|
|
096fb2b207 | ||
|
|
737686006e |
@@ -16,11 +16,6 @@ import (
|
|||||||
|
|
||||||
const routeTimeout = 60 * time.Second
|
const routeTimeout = 60 * time.Second
|
||||||
|
|
||||||
// cspHeader is the Content-Security-Policy applied to the embedded web SPA.
|
|
||||||
// The SPA loads external scripts and stylesheets from the same origin only;
|
|
||||||
// all API communication uses same-origin fetch (no WebSockets).
|
|
||||||
const cspHeader = "default-src 'self'; script-src 'self'; style-src 'self'"
|
|
||||||
|
|
||||||
// SetupRoutes configures the HTTP routes and middleware.
|
// SetupRoutes configures the HTTP routes and middleware.
|
||||||
func (srv *Server) SetupRoutes() {
|
func (srv *Server) SetupRoutes() {
|
||||||
srv.router = chi.NewRouter()
|
srv.router = chi.NewRouter()
|
||||||
@@ -138,11 +133,6 @@ func (srv *Server) setupSPA() {
|
|||||||
writer http.ResponseWriter,
|
writer http.ResponseWriter,
|
||||||
request *http.Request,
|
request *http.Request,
|
||||||
) {
|
) {
|
||||||
writer.Header().Set(
|
|
||||||
"Content-Security-Policy",
|
|
||||||
cspHeader,
|
|
||||||
)
|
|
||||||
|
|
||||||
readFS, ok := distFS.(fs.ReadFileFS)
|
readFS, ok := distFS.(fs.ReadFileFS)
|
||||||
if !ok {
|
if !ok {
|
||||||
fileServer.ServeHTTP(writer, request)
|
fileServer.ServeHTTP(writer, request)
|
||||||
|
|||||||
Reference in New Issue
Block a user