-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move X-Frame-Options ALLOW-FROM wiki page here
- Loading branch information
Showing
2 changed files
with
16 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
--- | ||
title: How do I use X–Frame–Options's "ALLOW–FROM" directive? | ||
--- | ||
|
||
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." | ||
|
||
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: | ||
|
||
```js | ||
// NOTE: `ALLOW-FROM` is not supported in most browsers. | ||
app.use((req, res, next) => { | ||
res.setHeader("X-Frame-Options", "ALLOW-FROM https://example.com"); | ||
next(); | ||
}); | ||
``` |