Rough implementation of auto HTTP->HTTPS redirects

Also added GracePeriod for server shutdowns
This commit is contained in:
Matthew Holt 2019-05-07 09:56:13 -06:00
parent 8eba582efe
commit e40bbecb16
5 changed files with 195 additions and 33 deletions

View file

@ -68,17 +68,11 @@ func (m matchScript) Match(r *http.Request) bool {
func (m matchProtocol) Match(r *http.Request) bool {
switch string(m) {
case "grpc":
if r.Header.Get("content-type") == "application/grpc" {
return true
}
return r.Header.Get("content-type") == "application/grpc"
case "https":
if r.TLS != nil {
return true
}
return r.TLS != nil
case "http":
if r.TLS == nil {
return true
}
return r.TLS == nil
}
return false