Can't seem to disable frameguard on specific route
See original GitHub issueI have helmet configured like this:
const app = express()
app.use(helmet())
// ...
app.use('/specificRoute', helmet.frameguard(false), (req, res) => { /* ... */ })
I also tried using helmet({ frameguard: false })
but had the same result - I still get the X-Frame-Options: SAMEORIGIN
header.
Issue Analytics
- State:
- Created 6 years ago
- Reactions:4
- Comments:7 (4 by maintainers)
Top Results From Across the Web
Is it possible to disable/remove a middleware for specific route ...
I want to disable a specific middleware, which I've set up ... And then I want to remove that bodyParser() for a specific...
Read more >Production Best Practices: Security - Express.js
This helps enforce secure (HTTPS) connections to the server. helmet.frameguard which sets the X-Frame-Options header. This provides clickjacking protection.
Read more >Bikepacker's Guide to Bike Frame Protection
There are some simple bike frame protection steps you can take to protect your bike from bikepacking bags and general wear and tear....
Read more >Laracasts Forum
Hi all, Sorry but I can't seem to understand how updateOrCreate works. ... How to disable FrameGuard middleware on specific routes or globally....
Read more >7 Protective Frame Tapes Ridden & Rated - Pinkbike
AMS large frame guard kit ... That can't be avoided unless you peel them off before applying the film. ... I went the...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
app.use(helmet())
sets theX-Frame-Options
header, and Helmet doesn’t have any mechanisms for undoing these headers. You could do something like this:Does that help?
I think you meant
res.removeHeader
rather thanreq.removeHeader
😉No, not really sure why you would say that, but maybe I’m missing something?
Disabling further down the line seems like a perfectly valid use-case; turn it on as a blanket-statement, then turn it off only as an exception. Shouldn’t be too hard to check if
action === false
in frameguard and if sores.removeHeader('X-Frame-Options')
.