8 - Alter HTTP Response Headers I noticed this question, which discusses various ways to alter HTTP Response Headers.

Where would I be able to execute:

$response-&gt;headers-&gt;remove('X-Frame-Options');


I attempted to place this within my THEMENAME.theme file, but perhaps I am not doing it right because $response is not defined where I am using it.

Where does $response come from?

Where can I execute $response-&gt;headers-&gt;remove('X-Frame-Options');?

Note: I understand the risks of removing the HTTP Header.  This is for development/testing purposes only.
Got it!

From these two sources:


How to embed drupal content in other sites (remove X-Frame-Options: SAMEORIGIN)?
https://wunderkraut.se/blogg/remove-xframe-options-and-set-contentsecuritypolicy


I realized that I was missing a mymodule.info.yml file.

mymodule 
  ├── mymodule.info.yml 
  ├── mymodule.services.yml 
  └── src 
    └── EventSubscriber 
      └── RemoveXFrameOptionsSubscriber.php


Then, go to /admin/modules in the backend (Extend tab) and install the new module &amp; clear all caches afterwards.

Woohoo!