mirror of
https://github.com/caddyserver/caddy.git
synced 2025-10-19 15:53:17 +00:00
Rough implementation of auto HTTP->HTTPS redirects
Also added GracePeriod for server shutdowns
This commit is contained in:
parent
8eba582efe
commit
e40bbecb16
5 changed files with 195 additions and 33 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue