Skip to content

Instantly share code, notes, and snippets.

@GarryOne
Created May 29, 2018 22:13
Show Gist options
  • Save GarryOne/5b1ae74222f7139c9cab5b4755913ba6 to your computer and use it in GitHub Desktop.
Save GarryOne/5b1ae74222f7139c9cab5b4755913ba6 to your computer and use it in GitHub Desktop.
PHP HTTP Security Headers
<?php
header('Strict-Transport-Security: max-age=63072000; includeSubDomains; preload'); // if ssl enabled
header('X-Frame-Options: SAMEORIGIN');
header('X-XSS-Protection: 1; mode=block');
header('X-Content-Type-Options: nosniff');
header('Content-Type: text/html; charset=utf-8');
header('Access-Control-Allow-Origin: '.$_SERVER['HTTP_ORIGIN']);
header('Expect-CT: max-age=7776000, enforce');
header('Referrer-Policy: origin-when-cross-origin');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment