@@ -5,7 +5,7 @@ import "github.com/gin-gonic/gin"
55// Config is a struct for specifying configuration options for the secure.
66type Config struct {
77 // AllowedHosts is a list of fully qualified domain names that are allowed.
8- //Default is empty list, which allows any and all host names.
8+ // Default is empty list, which allows any and all host names.
99 AllowedHosts []string
1010 // If SSLRedirect is set to true, then only allow https requests.
1111 // Default is false.
@@ -22,11 +22,11 @@ type Config struct {
2222 // If STSIncludeSubdomains is set to true, the `includeSubdomains` will
2323 // be appended to the Strict-Transport-Security header. Default is false.
2424 STSIncludeSubdomains bool
25- // If STSPreload is set to true, the `; preload` will be appended to the
26- // Strict-Transport-Security header. Default is false.
27- // Note that removal is non-trivial and enabling this means you need to
28- // support https long-term. See https://hstspreload.org/ for more info.
29- STSPreload bool
25+ // If STSPreload is set to true, the `; preload` will be appended to the
26+ // Strict-Transport-Security header. Default is false.
27+ // Note that removal is non-trivial and enabling this means you need to
28+ // support https long-term. See https://hstspreload.org/ for more info.
29+ STSPreload bool
3030 // If FrameDeny is set to true, adds the X-Frame-Options header with
3131 // the value of `DENY`. Default is false.
3232 FrameDeny bool
@@ -64,15 +64,17 @@ type Config struct {
6464
6565// DefaultConfig returns a Configuration with strict security settings.
6666// ```
67- // SSLRedirect: true
68- // IsDevelopment: false
69- // STSSeconds: 315360000
70- // STSIncludeSubdomains: true
71- // FrameDeny: true
72- // ContentTypeNosniff: true
73- // BrowserXssFilter: true
74- // ContentSecurityPolicy: "default-src 'self'"
75- // SSLProxyHeaders: map[string]string{"X-Forwarded-Proto": "https"},
67+ //
68+ // SSLRedirect: true
69+ // IsDevelopment: false
70+ // STSSeconds: 315360000
71+ // STSIncludeSubdomains: true
72+ // FrameDeny: true
73+ // ContentTypeNosniff: true
74+ // BrowserXssFilter: true
75+ // ContentSecurityPolicy: "default-src 'self'"
76+ // SSLProxyHeaders: map[string]string{"X-Forwarded-Proto": "https"},
77+ //
7678// ```
7779func DefaultConfig () Config {
7880 return Config {
0 commit comments