{"id":7711,"date":"2023-11-22T11:04:28","date_gmt":"2023-11-22T10:04:28","guid":{"rendered":"https:\/\/f.technology\/blog\/wordpress-en\/enhancing-security-with-http-security-headers\/"},"modified":"2023-11-22T11:04:28","modified_gmt":"2023-11-22T10:04:28","slug":"enhancing-security-with-http-security-headers","status":"publish","type":"post","link":"https:\/\/f.technology\/en\/blog\/cyber-security-en\/enhancing-security-with-http-security-headers\/","title":{"rendered":"Enhancing Security with HTTP Security Headers"},"content":{"rendered":"<h2>Why are HTTP Security Headers important and what are they?<\/h2>\n<p>  We might think of <strong>HTTP Security Headers<\/strong> as something extremely technical.<br \/>\nIn reality, this aspect of the structure of a blog or website needs to be investigated and addressed in the best possible way if you want to work in an SEO optimization perspective and maintain a high functionality of your portal.<br \/>\nPut another way, you cannot be online and ignore this topic: it is a parameter related to the security of the website, a security that today is part of the parameters known as <a href=\"https:\/\/developers.google.com\/search\/docs\/appearance?hl=it\" target=\"_blank\" rel=\"noopener nofollow\">Google Page Experience<\/a>, which is an overall evaluation of the various elements that make up the user experience.<br \/>\nInside we also find Core Web Vitals, optimization for mobile, the presence of HTTPS and, indeed, web page security.<br \/>\nHTTP Security Headers are directives, related to the security of the website, that are transmitted through the<a href=\"https:\/\/developer.mozilla.org\/en-US\/docs\/Glossary\/Response_header\" target=\"_blank\" rel=\"noopener nofollow\">HTTP header<\/a> response, which is the response that the web server gives to the browser software that is trying to access the website.<br \/>\nThe client, the program you use to browse, connects to your web space through a domain and receives various information.<br \/>\nSuch as the status code (200 if okay, 404 if bad).<br \/>\nHTTP Security Headers related security headers define limits and instructions that prevent unwanted and dangerous actions to your work published on the Internet.<br \/>\nThese elements are responsible for defining an advanced level of security.<br \/>\nBy limiting the behaviors allowed by the browser and the server (thus data request and response) once an action is performed by the user or a bot. Automated software is always scanning websites for security weaknesses.<br \/>\nSure, you can work on other fronts as well, such as using plugins to increase security and mounting a good firewall or using quality hosting.<br \/>\nBut that&#8217;s not always enough, which is why HTTP Security Headers come into play.<br \/>\nLet&#8217;s look together at the main guidelines you can use:              <\/p>\n<h3>Strict Transport Security (HSTS) &#8211; restrictive security on the HTTP transport<\/h3>\n<p>  The Strict-Transport-Security header (often shortened to HSTS) informs browsers that the site must be accessed only via HTTPS protocol and that any future attempts to access it via HTTP must be automatically converted to HTTPS.<br \/>\nThis is more secure than a common 301 redirect, which would allow<a href=\"https:\/\/it.wikipedia.org\/wiki\/Attacco_man_in_the_middle\" target=\"_blank\" rel=\"nofollow noopener\">man-in-the-middle<\/a> attacks.<br \/>\nThrough parameters, it is possible to set the maximum time for browsers to store the setting, as well as the application to subdomains.<br \/>\nExample:     <em>Strict-Transport-Security: max-age=31536000 ; includeSubDomains<\/em><\/p>\n<h3>Content Security Policy (CSP) &#8211; Content Security Policy<\/h3>\n<p>  This solution is designed to anticipate and defuse a wide range of attacks, including <a href=\"https:\/\/it.wikipedia.org\/wiki\/Cross-site_scripting\" target=\"_blank\" rel=\"nofollow noopener\">cross-site scripting<\/a> that uses a vulnerability in website security.<br \/>\nThrough such levity, such as <strong>using unsafe plugins or not updating WordPress themes<\/strong>, attackers can launch malicious scripts on a website that are then downloaded to the user&#8217;s browser (in which case, the portal could be banned by Google with irreparable damage).<br \/>\nThe Content Security Policy requires the browser to download only resources from a certain group of domains, consequently if the content security policy you apply is very restrictive you have to consider that it can have negative effects on the logic of your website, because there are many resources to be blocked!<br \/>\nThis security header is recommended for websites that handle sensitive user data, if you have a simple blog or informational site its usefulness is greatly reduced.<br \/>\nAlso you have to consider that it is not super easy to enable all CSP security features since you may need numerous customizations to the WordPress or website code.<br \/>\nFor example, to enable <a href=\"https:\/\/csp.withgoogle.com\/docs\/strict-csp.html\" target=\"_blank\" rel=\"nofollow noopener\">nonce-based strict CSP<\/a> you will have to edit callbacks to all dependencies used by the website, and that is not always trivial.<br \/>\nOn the other hand, if you want to choose to enable hash-based strict CSP you will have to include all inline scripts in your HTML template, because browsers are not allowed to use hashes on external dependencies.<br \/>\nTwo opposing methods that require major interventions to HTML templates and dependency inclusions.<br \/>\nAn example directive:          <em>Content-Security-Policy: font-src font.example.com;<\/em><\/p>\n<h3>X-Content-Type-Options<\/h3>\n<p>  This header is used by the server to signal that the <a href=\"https:\/\/developer.mozilla.org\/en-US\/docs\/Web\/HTTP\/Basics_of_HTTP\/MIME_types\" target=\"_blank\" rel=\"nofollow noopener\">MIME<\/a> types specified for the various content published on the page (images, files, Javascript, etc.) must be respected and not changed.<br \/>\nThis <strong>avoids misinterpretation of files<\/strong>: this would become crucial if a malicious file is masked as a different file type, exploiting the <a href=\"https:\/\/keycdn.com\/support\/what-is-mime-sniffing\" target=\"_blank\" rel=\"nofollow noopener\">MIME type sniffing<\/a> technique: this vulnerability occurs when a site allows data to be uploaded to the server and a user masks an HTML file as a different file type and this allows a security breach to open.<br \/>\nIt is triggered by the directive:    <em>X-Content-Type-Options: nosniff<\/em><\/p>\n<h3>Referrer Policy &#8211; Policy on Referrer<\/h3>\n<p>  This directive determines what information is passed to the landing site of a link placed on your Web site whenever you leave a page.<br \/>\nVarious options are available based on protocol (HTTP or HTTPS) and site (whether the same or another).<br \/>\nThe purpose of a Referrer-Policy header is to control what information is sent when a visitor leaves your pages to visit another portal.<br \/>\nThe default is to send domain, path and query string if you stay on the same site.<br \/>\nFor outbound queries you send the domain in case you stay on HTTPS.<br \/>\nNo data is sent should you switch to HTTP.<br \/>\nWith the no-referrer command the header will be omitted altogether, example:        <em>Referrer-Policy: no-referrer<\/em><\/p>\n<h3>Clear Site Data (CSD)<\/h3>\n<p>  The Clear-Site-Data parameter clears browsing data (cookie type, cache) related to the website.<br \/>\nIt allows webmasters to have more control over the information stored by a browsing browser.<br \/>\nThis header is useful during a logout process, for example, it ensures that all content stored on the browser is removed.<br \/>\nIn the header syntax you can indicate individual parameters to be deleted or use the asterisk to include all of them, including future ones that will be added.<br \/>\nExample:      <em>Clear-Site-Data: &#8220;cache&#8221;, &#8220;cookies&#8221;, &#8220;storage&#8221;<\/em><\/p>\n<h3>Permissions Policy<\/h3>\n<p>  Permissions Policy provides mechanisms that allow developers to explicitly declare what functionality can and cannot be used on a site.<br \/>\nIt defines a set of &#8220;policies&#8221; that restrict which APIs your site&#8217;s code can access or change the browser&#8217;s default behavior for certain functionality.This allows you to apply best practices and more securely compose third-party content.<br \/>\nPermissions Policy is similar to CSP but controls functionality instead of security behavior.<br \/>\nExamples of what you can do with Permissions Policy:     <\/p>\n<ul>\n<li>Changes the default behavior of automatic playback on mobile and third-party videos;<\/li>\n<li>limits a site&#8217;s use of sensitive devices such as a camera, microphone, or speakers;<\/li>\n<li>allow iframes to use the &#8216;full-screen API;<\/li>\n<li>stops executing scripts on elements if they are not visible in the viewport, to improve performance.<\/li>\n<\/ul>\n<h3>X-Frame-Options<\/h3>\n<p>  The X-Frame-Options header is a security measure that prevents the browser from loading web pages in a  &lt;frame&gt;,  &lt;iframe&gt;,  &lt;embed&gt;  o  &lt;object&gt;.<br \/>\nL&#8217;abilitazione delle intestazioni di risposta HTTP X-Frame-Options consente di difendersi dagli attacchi <a href=\"https:\/\/owasp.org\/www-community\/attacks\/Cross_Frame_Scripting\" target=\"_blank\" rel=\"nofollow noopener\">Cross-Frame Scripting (XFS)<\/a>, dal clickjacking e da altre forme di attacco informatico: attivandola, i tuoi contenuti non saranno embeddati altrove.<br \/>\nQuesto header non \u00e8 pi\u00f9 in uso ed \u00e8 preferibile utilizzare gli strumenti della CSP.    <\/p>\n<h2>Conclusions<\/h2>\n<p>  From our experience, we have found that activating <strong>very stringent headers<\/strong> involves on the one hand <strong>meeting the highest security parameters<\/strong>, often required by companies under analysis by external consultants, and on the other hand an <strong>investment of not insignificant resources<\/strong> and the technical skills of an operator who can dialogue with hosting support and any developers active on the project in order to <strong>meticulously choose the resources allowed.<\/strong><br \/>\nOften rehashing projects with very stringent CSPs, perhaps adding a new plugin or functionality with active third parties, also involves additional intervention to the activated headers.<br \/>\nWe therefore recommend a smart and elastic solution that is not too restrictive and goes hand in hand with constant monitoring systems such as <a href=\"https:\/\/wpremote.com\/\" target=\"_blank\" rel=\"noopener nofollow\"><strong>WP Remote<\/strong><\/a>, the BlogVault platform that we use to monitor the security and performance status of websites under WP-HELP contract.  <\/p>\n","protected":false},"excerpt":{"rendered":"<p>Why are HTTP Security Headers important and what are they? We might think of HTTP Security Headers as something extremely technical. In reality, this aspect of the structure of a blog or website needs to be investigated and addressed in the best possible way if you want to work in an SEO optimization perspective and [&hellip;]<\/p>\n","protected":false},"author":5,"featured_media":3574,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[71],"tags":[],"class_list":["post-7711","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-cyber-security-en"],"acf":[],"_links":{"self":[{"href":"https:\/\/f.technology\/en\/wp-json\/wp\/v2\/posts\/7711","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/f.technology\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/f.technology\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/f.technology\/en\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/f.technology\/en\/wp-json\/wp\/v2\/comments?post=7711"}],"version-history":[{"count":0,"href":"https:\/\/f.technology\/en\/wp-json\/wp\/v2\/posts\/7711\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/f.technology\/en\/wp-json\/wp\/v2\/media\/3574"}],"wp:attachment":[{"href":"https:\/\/f.technology\/en\/wp-json\/wp\/v2\/media?parent=7711"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/f.technology\/en\/wp-json\/wp\/v2\/categories?post=7711"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/f.technology\/en\/wp-json\/wp\/v2\/tags?post=7711"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}<!-- This website is optimized by Airlift. Learn more: https://airlift.net. Template:. Learn more: https://airlift.net. Template: 6a7be447d36f735376cd1fc8. Config Timestamp: 2026-08-12 03:11:02 UTC, Cached Timestamp: 2026-08-12 05:13:05 UTC -->