brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: X_FRAME_OPTIONS decides whether your apps can be shown in an iframe

Security
~/tips/tip-nginxproxymanager-x-frame

environment:

Allows Nginx Proxy Manager hosts to be shown in iframes from the same origin.

You put a proxied app in a dashboard iframe and get a blank box. Nothing in the app is broken. The header is doing its job.

NPM sends an X-Frame-Options header, and the default value is deny, so browsers refuse to show the page inside any frame. The docs give one environment variable to change it:

environment:
  X_FRAME_OPTIONS: "sameorigin"

With sameorigin a page may be framed only by a page from the same origin. That is enough for apps that embed their own subpages, and it still blocks other sites from framing yours.

The caveat is that the setting is global for the container. You cannot make one host frameable and the rest strict with this variable alone. Clickjacking is the reason the header exists, so I would only loosen it when I actually need an iframe, and only as far as sameorigin. Dashboards on another domain still will not work with it, which is the right outcome for most setups.

You can check the result in the browser developer tools. Open the network tab, click the main request and look at the response headers. After the change the header should read sameorigin instead of deny.

Further reading: Nginx Proxy Manager: Advanced Configuration, On this site: an access list with a password can lock you out of the app behind it, On this site: run Nginx Proxy Manager as a normal user with PUID and PGID

Going deeper: Guide: fix a 502 Bad Gateway in Nginx Proxy Manager, with a checklist that finds the cause

More Security tips tcpdump -nn -r capture.pcap port 53 mkcert -install Strict-Transport-Security: max-age=0 Referrer-Policy: strict-origin-when-cross-origin wp super-admin list All Security tips (79) All topics

Link