From 2755422a29bb2ee013b8b47e4cdfbdbcfae1af7d Mon Sep 17 00:00:00 2001 From: Michael Quigley Date: Wed, 24 Jul 2024 10:47:12 -0400 Subject: [PATCH] iteration (#704) --- endpoints/publicProxy/http.go | 16 +++++++++------- sdk/golang/sdk/config.go | 11 +++++++---- 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/endpoints/publicProxy/http.go b/endpoints/publicProxy/http.go index d4083724..5e3ba4e8 100644 --- a/endpoints/publicProxy/http.go +++ b/endpoints/publicProxy/http.go @@ -159,13 +159,15 @@ func shareHandler(handler http.Handler, pcfg *Config, key []byte, ctx ziti.Conte if svc, found := endpoints.GetRefreshedService(shrToken, ctx); found { if cfg, found := svc.Config[sdk.ZrokProxyConfig]; found { if pcfg.Interstitial { - if _, istlFound := cfg["interstitial"]; istlFound { - skip := r.Header.Get("skip_zrok_interstitial") - _, zrokOkErr := r.Cookie("zrok_interstitial") - if skip == "" && zrokOkErr != nil { - logrus.Debugf("forcing interstitial for '%v'", r.URL) - interstitialUi.WriteInterstitialAnnounce(w) - return + if v, istlFound := cfg["interstitial"]; istlFound { + if istlEnabled, ok := v.(bool); ok && istlEnabled { + skip := r.Header.Get("skip_zrok_interstitial") + _, zrokOkErr := r.Cookie("zrok_interstitial") + if skip == "" && zrokOkErr != nil { + logrus.Debugf("forcing interstitial for '%v'", r.URL) + interstitialUi.WriteInterstitialAnnounce(w) + return + } } } } diff --git a/sdk/golang/sdk/config.go b/sdk/golang/sdk/config.go index 38748e78..e07000bb 100644 --- a/sdk/golang/sdk/config.go +++ b/sdk/golang/sdk/config.go @@ -1,13 +1,16 @@ package sdk -import "github.com/pkg/errors" +import ( + "github.com/pkg/errors" +) const ZrokProxyConfig = "zrok.proxy.v1" type FrontendConfig struct { - AuthScheme AuthScheme `json:"auth_scheme"` - BasicAuth *BasicAuthConfig `json:"basic_auth"` - OauthAuth *OauthConfig `json:"oauth"` + Interstitial bool `json:"interstitial"` + AuthScheme AuthScheme `json:"auth_scheme"` + BasicAuth *BasicAuthConfig `json:"basic_auth"` + OauthAuth *OauthConfig `json:"oauth"` } type BasicAuthConfig struct {