Skip to content

Commit 646fd5c

Browse files
committed
Move X-Frame-Options ALLOW-FROM wiki page here
1 parent 8b5eba6 commit 646fd5c

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

content/faq/_index.md

+1
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,5 @@ title: "Frequently asked questions (FAQ)"
1414
- [How do I set a custom `X-Powered-By` header?]({{< ref "faq/custom-x-powered-by" >}})
1515
- [How do I disable blocking with the `X-XSS-Protection` header?]({{< ref "faq/x-xss-protection-disable-blocking" >}})
1616
- [How do I enable the `report` directive with the `X-XSS-Protection` header?]({{< ref "faq/x-xss-protection-report-directive" >}})
17+
- [How do I use `X–Frame–Options`'s `ALLOW–FROM` directive?]({{< ref "faq/x-frame-options-allow-from-directive" >}})
1718
- [Who made Helmet?]({{< ref "faq/contributors" >}})
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
---
2+
title: How do I use X–Frame–Options's "ALLOW–FROM" directive?
3+
---
4+
5+
The `X-Frame-Options` header has a directive, `ALLOW-FROM`, which is obsolete. It has [limited browser support](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Frame-Options#Browser_compatibility) and is improved by the [`frame-ancestors` Content Security Policy directive](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy/frame-ancestors). To quote MDN: "don't use it."
6+
7+
If you *need* to set this directive value for some reason, you can create your own small middleware function. Here's what that might look like:
8+
9+
```js
10+
// NOTE: `ALLOW-FROM` is not supported in most browsers.
11+
app.use((req, res, next) => {
12+
res.setHeader("X-Frame-Options", "ALLOW-FROM https://example.com");
13+
next();
14+
});
15+
```

0 commit comments

Comments
 (0)