mirror of
https://github.com/discourse/discourse.git
synced 2025-04-22 01:22:31 +08:00

In some error paths, headers that were set earlier can get overwritten (e.g. `Cross-Origin-Opener-Policy`) by middleware such as ActionDispatch::ShowExceptions. This PR sets the `Cross-Origin-Opener-Policy` header to the value of the SiteSetting `cross_origin_opener_policy_header` if it's missing and if the response is for HTML. In future, this DefaultHeaders middleware can be used to set other default headers that relate to security or other purposes. ### Testing <img width="631" alt="test" src="https://github.com/user-attachments/assets/05106a40-2bc7-435d-91a2-4dd2a098f349" />