Skip to content

Commit

Permalink
Disable TLS when http-only=true
Browse files Browse the repository at this point in the history
  • Loading branch information
wpjunior committed Oct 31, 2024
1 parent 94e9cc9 commit 696dfd8
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions api/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,16 @@ func (a *RouterAPI) supportTLS(w http.ResponseWriter, r *http.Request) error {
if err != nil {
return err
}

headerOpts := r.Header.Values("X-Router-Opt")
for _, opt := range headerOpts {
if opt == "http-only=true" {
w.WriteHeader(http.StatusNotFound)
fmt.Fprintf(w, "No TLS Capabilities, disabled via header")
return nil
}
}

_, ok := svc.(router.RouterTLS)
if !ok {
w.WriteHeader(http.StatusNotFound)
Expand Down

0 comments on commit 696dfd8

Please sign in to comment.