fix: web ui should only respond to get requests

This commit is contained in:
henrygd
2025-02-11 11:04:19 -05:00
parent 1f69937572
commit a94cfff965

View File

@@ -126,7 +126,7 @@ func (h *Hub) Run() {
Scheme: "http", Scheme: "http",
Host: "localhost:5173", Host: "localhost:5173",
}) })
se.Router.Any("/{path...}", func(e *core.RequestEvent) error { se.Router.GET("/{path...}", func(e *core.RequestEvent) error {
proxy.ServeHTTP(e.Response, e.Request) proxy.ServeHTTP(e.Response, e.Request)
return nil return nil
}) })
@@ -146,7 +146,7 @@ func (h *Hub) Run() {
// get CSP configuration // get CSP configuration
csp, cspExists := GetEnv("CSP") csp, cspExists := GetEnv("CSP")
// add route // add route
se.Router.Any("/{path...}", func(e *core.RequestEvent) error { se.Router.GET("/{path...}", func(e *core.RequestEvent) error {
// serve static assets if path is in staticPaths // serve static assets if path is in staticPaths
for i := range staticPaths { for i := range staticPaths {
if strings.Contains(e.Request.URL.Path, staticPaths[i]) { if strings.Contains(e.Request.URL.Path, staticPaths[i]) {