File tree Expand file tree Collapse file tree 2 files changed +15
-1
lines changed
Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -17,6 +17,10 @@ http {
1717 '"$http_user_agent" "$http_x_forwarded_for"';
1818 access_log /var/log/nginx/access.log main;
1919 add_header X-Frame-Options SAMEORIGIN;
20+ add_header X-Content-Type-Options nosniff;
21+ add_header X-XSS-Protection "1; mode=block";
22+ add_header Referrer-Policy "strict-origin-when-cross-origin";
23+ add_header Permissions-Policy "geolocation=(), microphone=(), camera=()";
2024
2125 client_body_temp_path /var/cache/nginx/client_temp;
2226 proxy_temp_path /var/cache/nginx/proxy_temp;
Original file line number Diff line number Diff line change 133133 * More info at: https://docs.bitnami.com/general/apps/wordpress/troubleshooting/xmlrpc-and-pingback/
134134 */
135135if (!defined ('WP_CLI ' )) {
136- // remove x-pingback HTTP header
136+ // remove x-pingback and add security headers
137137 add_filter ("wp_headers " , function ($ headers ) {
138138 unset($ headers ["X-Pingback " ]);
139+
140+ $ headers ["X-Content-Type-Options " ] = "nosniff " ;
141+ $ headers ["X-XSS-Protection " ] = "1; mode=block " ;
142+ $ headers ["Referrer-Policy " ] = "strict-origin-when-cross-origin " ;
143+ $ headers ["Permissions-Policy " ] = "geolocation=(), microphone=(), camera=() " ;
144+
145+ if (function_exists ("is_ssl " ) && is_ssl ()) {
146+ $ headers ["Strict-Transport-Security " ] = "max-age=31536000; includeSubDomains " ;
147+ }
148+
139149 return $ headers ;
140150 });
141151 // disable pingbacks
You can’t perform that action at this time.
0 commit comments