mirror of
https://codeberg.org/git-pages/git-pages.git
synced 2026-05-14 11:11:35 +00:00
Add [[wildcard]].fallback-insecure option to disable TLS verification.
This is intended for local deployments only.
This commit is contained in:
@@ -52,10 +52,11 @@ type ServerConfig struct {
|
||||
}
|
||||
|
||||
type WildcardConfig struct {
|
||||
Domain string `toml:"domain"`
|
||||
CloneURL string `toml:"clone-url"`
|
||||
IndexRepos []string `toml:"index-repos" default:"[]"`
|
||||
FallbackProxyTo string `toml:"fallback-proxy-to"`
|
||||
Domain string `toml:"domain"`
|
||||
CloneURL string `toml:"clone-url"`
|
||||
IndexRepos []string `toml:"index-repos" default:"[]"`
|
||||
FallbackProxyTo string `toml:"fallback-proxy-to"`
|
||||
FallbackInsecure bool `toml:"fallback-insecure"`
|
||||
}
|
||||
|
||||
type CacheConfig struct {
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package git_pages
|
||||
|
||||
import (
|
||||
"crypto/tls"
|
||||
"fmt"
|
||||
"log"
|
||||
"net/http"
|
||||
@@ -17,6 +18,7 @@ type WildcardPattern struct {
|
||||
CloneURL *fasttemplate.Template
|
||||
IndexRepos []*fasttemplate.Template
|
||||
FallbackURL *url.URL
|
||||
Insecure bool
|
||||
}
|
||||
|
||||
var wildcardPatterns []*WildcardPattern
|
||||
@@ -61,6 +63,11 @@ func HandleWildcardFallback(w http.ResponseWriter, r *http.Request) (bool, error
|
||||
r.Out.Host = r.In.Host
|
||||
r.Out.Header["X-Forwarded-For"] = r.In.Header["X-Forwarded-For"]
|
||||
},
|
||||
Transport: &http.Transport{
|
||||
TLSClientConfig: &tls.Config{
|
||||
InsecureSkipVerify: pattern.Insecure,
|
||||
},
|
||||
},
|
||||
}).ServeHTTP(w, r)
|
||||
|
||||
return true, nil
|
||||
@@ -99,6 +106,7 @@ func ConfigureWildcards(configs []WildcardConfig) error {
|
||||
CloneURL: cloneURLTemplate,
|
||||
IndexRepos: indexRepoTemplates,
|
||||
FallbackURL: fallbackURL,
|
||||
Insecure: config.FallbackInsecure,
|
||||
})
|
||||
}
|
||||
return nil
|
||||
|
||||
Reference in New Issue
Block a user