Skip to content

Commit

Permalink
Surround HSTS header value with "" + add endpoint to openapi.yaml
Browse files Browse the repository at this point in the history
  • Loading branch information
pondzix committed Jan 29, 2024
1 parent f55c81e commit f5e9718
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
15 changes: 12 additions & 3 deletions provisioning/resources/configs/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -221,9 +221,18 @@ paths:
description: "Telemetry has been reconfigured"
"401":
description: "Unauthorized"



/add-hsts:
put:
tags:
- "configuration"
summary: "Add HSTS header"
description: "Adds HSTS header to underlying caddy configuration. When added, 'Strict-Transport-Security' header is returned for each HTTPS response"
operationId: "addHsts"
responses:
"200":
description: "HSTS header has been added"
"401":
description: "Unauthorized"

/restart-services:
put:
Expand Down
2 changes: 1 addition & 1 deletion provisioning/resources/control-plane/add_hsts_header.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ func addHstsHeader(configPath string) error {
`
handle @isHttps {
import handleProtectedPaths
header Strict-Transport-Security max-age=31536000; includeSubDomains
header Strict-Transport-Security "max-age=31536000; includeSubDomains"
}
`
newCaddyConfig := strings.Replace(string(currentConfig), toReplacePattern, replaceWithHsts, 1)
Expand Down

0 comments on commit f5e9718

Please sign in to comment.