Clickjacking attacks are blocked by setting specific HTTP response headers that tell browsers not to render your site inside an iframe. Here’s how to secure your site, whether it’s WordPress, Apache, NGINX, or custom PHP.
Use the NoClickjack tool to:
Header always set X-Frame-Options "SAMEORIGIN" Header always set Content-Security-Policy "frame-ancestors 'self';"
add_header X-Frame-Options "SAMEORIGIN" always; add_header Content-Security-Policy "frame-ancestors 'self';";
function add_clickjacking_protection_headers() {
header('X-Frame-Options: SAMEORIGIN');
header("Content-Security-Policy: frame-ancestors 'self'");
}
add_action('send_headers', 'add_clickjacking_protection_headers');
Go back to the NoClickjack tool, scan again, and make sure the status shows Safe.
X-Frame-Options: SAMEORIGIN Content-Security-Policy: frame-ancestors 'self';
| Step | Action | Result |
|---|---|---|
| 1 | Scan with NoClickjack | Check if your site is vulnerable |
| 2 | Add required headers | Block iframe-based attacks |
| 3 | Re-scan | Confirm safety status |