mirror of
https://github.com/openziti/zrok.git
synced 2025-06-20 01:37:52 +02:00
frontend config for interstitial enable/disable; zrok.proxy.v1 support for interstitial enablement (#704)
This commit is contained in:
parent
b7423ca59e
commit
2e3d6a627f
@ -16,6 +16,7 @@ type Config struct {
|
|||||||
Identity string
|
Identity string
|
||||||
Address string
|
Address string
|
||||||
HostMatch string
|
HostMatch string
|
||||||
|
Interstitial bool
|
||||||
Oauth *OauthConfig
|
Oauth *OauthConfig
|
||||||
Tls *endpoints.TlsConfig
|
Tls *endpoints.TlsConfig
|
||||||
}
|
}
|
||||||
@ -47,6 +48,7 @@ func DefaultConfig() *Config {
|
|||||||
return &Config{
|
return &Config{
|
||||||
Identity: "public",
|
Identity: "public",
|
||||||
Address: "0.0.0.0:8080",
|
Address: "0.0.0.0:8080",
|
||||||
|
Interstitial: false,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -158,14 +158,17 @@ func shareHandler(handler http.Handler, pcfg *Config, key []byte, ctx ziti.Conte
|
|||||||
if shrToken != "" {
|
if shrToken != "" {
|
||||||
if svc, found := endpoints.GetRefreshedService(shrToken, ctx); found {
|
if svc, found := endpoints.GetRefreshedService(shrToken, ctx); found {
|
||||||
if cfg, found := svc.Config[sdk.ZrokProxyConfig]; found {
|
if cfg, found := svc.Config[sdk.ZrokProxyConfig]; found {
|
||||||
|
if pcfg.Interstitial {
|
||||||
ignore := r.Header.Get("zrok_interstitial")
|
if _, istlFound := cfg["interstitial"]; istlFound {
|
||||||
|
skip := r.Header.Get("skip_zrok_interstitial")
|
||||||
_, zrokOkErr := r.Cookie("zrok_interstitial")
|
_, zrokOkErr := r.Cookie("zrok_interstitial")
|
||||||
if ignore == "" && zrokOkErr != nil {
|
if skip == "" && zrokOkErr != nil {
|
||||||
logrus.Infof("forcing interstitial for: %v", r.URL)
|
logrus.Debugf("forcing interstitial for '%v'", r.URL)
|
||||||
interstitialUi.WriteInterstitialAnnounce(w)
|
interstitialUi.WriteInterstitialAnnounce(w)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if scheme, found := cfg["auth_scheme"]; found {
|
if scheme, found := cfg["auth_scheme"]; found {
|
||||||
switch scheme {
|
switch scheme {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user