mirror of
https://github.com/QuantumNous/new-api.git
synced 2026-09-13 07:40:56 +00:00
feat(session): support opt-in Secure session cookies
- add SESSION_COOKIE_SECURE / SESSION_COOKIE_TRUSTED_URL env vars with startup validation: enabling Secure requires at least one trusted HTTPS entry URL - wire common.SessionCookieSecure into the session cookie store instead of a hardcoded Secure=false - print a startup warning when Secure session cookies are disabled - document the new settings in .env.example and docker-compose files Secure stays off by default because many deployments front new-api with plain-HTTP reverse proxies, where a hardcoded Secure default would break logins entirely; enabling it safely depends on the deployment's TLS setup, so it ships as an opt-in deployment-hardening flag.
This commit is contained in:
+1
-1
@@ -15,7 +15,7 @@ func CORS() gin.HandlerFunc {
|
||||
return cors.New(config)
|
||||
}
|
||||
|
||||
func PoweredBy() gin.HandlerFunc {
|
||||
func Version() gin.HandlerFunc {
|
||||
return func(c *gin.Context) {
|
||||
c.Header("X-New-Api-Version", common.Version)
|
||||
c.Next()
|
||||
|
||||
Reference in New Issue
Block a user