You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
### Set the `IsDevelopment` option to `true` when developing!
56
-
When `IsDevelopment` is true, the AllowedHosts, SSLRedirect, STS header, and HPKP header will not be in effect. This allows you to work in development/test mode and not have any annoying redirects to HTTPS (ie. development can happen on HTTP), or block `localhost` has a bad host.
56
+
When `IsDevelopment` is true, the AllowedHosts, SSLRedirect, and STS header will not be in effect. This allows you to work in development/test mode and not have any annoying redirects to HTTPS (ie. development can happen on HTTP), or block `localhost` has a bad host.
57
57
58
58
### Available options
59
59
Secure comes with a variety of configuration options (Note: these are not the default option values. See the defaults below.):
@@ -80,12 +80,10 @@ s := secure.New(secure.Options{
80
80
BrowserXssFilter: true, // If BrowserXssFilter is true, adds the X-XSS-Protection header with the value `1; mode=block`. Default is false.
81
81
CustomBrowserXssValue: "1; report=https://example.com/xss-report", // CustomBrowserXssValue allows the X-XSS-Protection header value to be set with a custom value. This overrides the BrowserXssFilter option. Default is "".
82
82
ContentSecurityPolicy: "default-src 'self'", // ContentSecurityPolicy allows the Content-Security-Policy header value to be set with a custom value. Default is "". Passing a template string will replace `$NONCE` with a dynamic nonce value of 16 bytes for each request which can be later retrieved using the Nonce function.
83
-
PublicKey: `pin-sha256="base64+primary=="; pin-sha256="base64+backup=="; max-age=5184000; includeSubdomains; report-uri="https://www.example.com/hpkp-report"`, // Deprecated: This feature is no longer recommended. PublicKey implements HPKP to prevent MITM attacks with forged certificates. Default is "".
84
83
ReferrerPolicy: "same-origin", // ReferrerPolicy allows the Referrer-Policy header with the value to be set with a custom value. Default is "".
85
84
FeaturePolicy: "vibrate 'none';", // Deprecated: this header has been renamed to PermissionsPolicy. FeaturePolicy allows the Feature-Policy header with the value to be set with a custom value. Default is "".
86
85
PermissionsPolicy: "fullscreen=(), geolocation=()", // PermissionsPolicy allows the Permissions-Policy header with the value to be set with a custom value. Default is "".
87
86
CrossOriginOpenerPolicy: "same-origin", // CrossOriginOpenerPolicy allows the Cross-Origin-Opener-Policy header with the value to be set with a custom value. Default is "".
IsDevelopment: true, // This will cause the AllowedHosts, SSLRedirect, and STSSeconds/STSIncludeSubdomains options to be ignored during development. When deploying to production, be sure to set this to false.
91
89
})
@@ -123,7 +121,6 @@ l := secure.New(secure.Options{
// CustomFrameOptionsValue allows the X-Frame-Options header value to be set with a custom value. This overrides the FrameDeny option. Default is "".
84
83
CustomFrameOptionsValuestring
85
-
// PublicKey implements HPKP to prevent MITM attacks with forged certificates. Default is "".
86
-
// Deprecated: This feature is no longer recommended. Though some browsers might still support it, it may have already been removed from the relevant web standards, may be in the process of being dropped, or may only be kept for compatibility purposes. Avoid using it, and update existing code if possible.
87
-
PublicKeystring
88
84
// ReferrerPolicy allows sites to control when browsers will pass the Referer header to other sites. Default is "".
89
85
ReferrerPolicystring
90
86
// FeaturePolicy allows to selectively enable and disable use of various browser features and APIs. Default is "".
@@ -112,8 +108,6 @@ type Options struct {
112
108
SSLProxyHeadersmap[string]string
113
109
// STSSeconds is the max-age of the Strict-Transport-Security header. Default is 0, which would NOT include the header.
114
110
STSSecondsint64
115
-
// ExpectCTHeader allows the Expect-CT header value to be set with a custom value. Default is "".
116
-
ExpectCTHeaderstring
117
111
// SecureContextKey allows a custom key to be specified for context storage.
118
112
SecureContextKeystring
119
113
}
@@ -434,11 +428,6 @@ func (s *Secure) processRequest(w http.ResponseWriter, r *http.Request) (http.He
0 commit comments