How to fix x frame options weak on Adobe Commerce (Magento)

Change the X-Frame-Options response header from its current weak or missing value to either DENY or SAMEORIGIN so your store cannot be embedded in a malicious iframe.

Steps for Adobe Commerce (Magento)

  1. In the Magento admin panel go to Stores → Configuration → General → Web → Default Pages — look for any built-in header setting (varies by version).
  2. The most reliable method: open your Nginx vhost config for Magento (typically /etc/nginx/sites-available/your-store.conf) and inside the server {} block add: add_header X-Frame-Options "DENY" always; Reload Nginx: sudo nginx -s reload
  3. For Apache: open your .htaccess or VirtualHost config and add: Header always set X-Frame-Options "DENY" Then restart Apache.
  4. Alternatively install the Magento 2 module 'magento2-security-headers' via Composer: composer require your-vendor/security-headers, then run bin/magento setup:upgrade and configure in admin.
  5. Verify by loading your storefront and inspecting response headers in DevTools.
Official Adobe Commerce (Magento) documentation ↗
X-Frame-Options: DENY

What is x frame options weak?

The X-Frame-Options HTTP header is a one-line instruction your web server sends to every visitor's browser telling it whether your store's pages are allowed to be loaded inside an iframe (a "page within a page") on another website. There are two safe values: DENY (no site, including your own, can frame your pages) and SAMEORIGIN (only pages on your own domain can frame them). A weak or absent value means any website on the internet can load your store inside an invisible or disguised iframe — a classic attack called clickjacking.

Clickjacking lets attackers overlay your real checkout or login page inside a transparent iframe on a fake site, tricking customers into clicking buttons they can't see — handing over payment details, credentials, or completing purchases they didn't intend. This is a direct revenue, fraud, and brand-trust risk. It also violates PCI-DSS requirements around protecting cardholder data environments and can expose you to legal liability if customers are defrauded through your site. Google's Safe Browsing program can flag sites involved in such abuse, which destroys organic search rankings overnight.

See the complete X frame options weak guide for every platform and the full background.

Not sure if your Adobe Commerce (Magento) store has this?

Run a free SEOLZ audit — we’ll find x frame options weak and every other issue across your whole site.

Scan my site free

Fix x frame options weak on another platform