summaryrefslogtreecommitdiff
path: root/handlers/php_proxy.go
diff options
context:
space:
mode:
authorhaturatu <taro@eyes4you.org>2025-10-13 00:08:25 +0900
committerhaturatu <taro@eyes4you.org>2025-10-13 00:08:25 +0900
commit15830af5b190cfb6f28e0bdf0f4bf110256ed9ef (patch)
treeefd3c4bdd00f8bea6df8ba2155015d18db5cfba2 /handlers/php_proxy.go
parent6515a6fd2b2d29a8f363c906148f3abf7cf982e9 (diff)
fix(csrf): js csrf support
Diffstat (limited to 'handlers/php_proxy.go')
-rw-r--r--handlers/php_proxy.go4
1 files changed, 4 insertions, 0 deletions
diff --git a/handlers/php_proxy.go b/handlers/php_proxy.go
index d30f363..24a38dc 100644
--- a/handlers/php_proxy.go
+++ b/handlers/php_proxy.go
@@ -13,6 +13,7 @@ import (
"strconv"
"strings"
+ "github.com/gorilla/csrf"
fcgiclient "github.com/tomasen/fcgi_client"
)
@@ -78,6 +79,9 @@ func NewPhpProxyHandler(scriptName string) http.Handler {
env["AUTH_PATH_ADMIN_USERS_API"] = config.Paths.AdminUsersAPI
env["AUTH_ASSETS_PATH"] = config.Paths.Assets
+ // Pass CSRF token to PHP
+ env["HTTP_X_CSRF_TOKEN"] = csrf.Token(r)
+
// Asynchronously log the proxying action to avoid blocking the request.
worker.Submit(workerPool, func() {