File tree Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -123,7 +123,7 @@ func StartProxy(config *config.Config) error {
123
123
124
124
router .Any ("/*path" , func (ctx * gin.Context ) {
125
125
if ctx .Request .Method == "POST" && ctx .Request .URL .Path == ACCEPT_PREVIEW_PAGE_WARNING_PATH {
126
- handleAcceptProxyWarning (ctx , config .EnableTLS )
126
+ handleAcceptProxyWarning (ctx , config .ProxyProtocol == "https" )
127
127
return
128
128
}
129
129
Original file line number Diff line number Diff line change @@ -22,6 +22,15 @@ const (
22
22
)
23
23
24
24
func handleAcceptProxyWarning (ctx * gin.Context , secure bool ) {
25
+ // Set SameSite attribute based on security context
26
+ if secure {
27
+ // For HTTPS, use SameSite=None to allow cross-origin iframe usage
28
+ ctx .SetSameSite (http .SameSiteNoneMode )
29
+ } else {
30
+ // For HTTP (local dev), use SameSite=Lax
31
+ ctx .SetSameSite (http .SameSiteLaxMode )
32
+ }
33
+
25
34
// Set the acceptance cookie
26
35
ctx .SetCookie (
27
36
PREVIEW_PAGE_ACCEPT_COOKIE_NAME ,
You can’t perform that action at this time.
0 commit comments