mirror of
https://github.com/openziti/zrok.git
synced 2024-11-21 23:53:19 +01:00
frontend config for interstitial enable/disable; zrok.proxy.v1 support for interstitial enablement (#704)
This commit is contained in:
parent
b7423ca59e
commit
2e3d6a627f
@ -12,12 +12,13 @@ import (
|
|||||||
const V = 3
|
const V = 3
|
||||||
|
|
||||||
type Config struct {
|
type Config struct {
|
||||||
V int
|
V int
|
||||||
Identity string
|
Identity string
|
||||||
Address string
|
Address string
|
||||||
HostMatch string
|
HostMatch string
|
||||||
Oauth *OauthConfig
|
Interstitial bool
|
||||||
Tls *endpoints.TlsConfig
|
Oauth *OauthConfig
|
||||||
|
Tls *endpoints.TlsConfig
|
||||||
}
|
}
|
||||||
|
|
||||||
type OauthConfig struct {
|
type OauthConfig struct {
|
||||||
@ -45,8 +46,9 @@ type OauthProviderConfig struct {
|
|||||||
|
|
||||||
func DefaultConfig() *Config {
|
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,13 +158,16 @@ 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 {
|
||||||
_, zrokOkErr := r.Cookie("zrok_interstitial")
|
skip := r.Header.Get("skip_zrok_interstitial")
|
||||||
if ignore == "" && zrokOkErr != nil {
|
_, zrokOkErr := r.Cookie("zrok_interstitial")
|
||||||
logrus.Infof("forcing interstitial for: %v", r.URL)
|
if skip == "" && zrokOkErr != nil {
|
||||||
interstitialUi.WriteInterstitialAnnounce(w)
|
logrus.Debugf("forcing interstitial for '%v'", r.URL)
|
||||||
return
|
interstitialUi.WriteInterstitialAnnounce(w)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if scheme, found := cfg["auth_scheme"]; found {
|
if scheme, found := cfg["auth_scheme"]; found {
|
||||||
|
Loading…
Reference in New Issue
Block a user