mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-07-01 13:04:52 +02:00
Support ALLOW_IFRAME env variable to not include frame-ancestors header #3684
This commit is contained in:
parent
9a1c773b7a
commit
3b4a5b8785
2 changed files with 6 additions and 2 deletions
|
@ -53,6 +53,7 @@ class Server {
|
|||
global.RouterBasePath = ROUTER_BASE_PATH
|
||||
global.XAccel = process.env.USE_X_ACCEL
|
||||
global.AllowCors = process.env.ALLOW_CORS === '1'
|
||||
global.AllowIframe = process.env.ALLOW_IFRAME === '1'
|
||||
global.DisableSsrfRequestFilter = process.env.DISABLE_SSRF_REQUEST_FILTER === '1'
|
||||
|
||||
if (!fs.pathExistsSync(global.ConfigPath)) {
|
||||
|
@ -194,8 +195,10 @@ class Server {
|
|||
const app = express()
|
||||
|
||||
app.use((req, res, next) => {
|
||||
// Prevent clickjacking by disallowing iframes
|
||||
res.setHeader('Content-Security-Policy', "frame-ancestors 'self'")
|
||||
if (!global.AllowIframe) {
|
||||
// Prevent clickjacking by disallowing iframes
|
||||
res.setHeader('Content-Security-Policy', "frame-ancestors 'self'")
|
||||
}
|
||||
|
||||
/**
|
||||
* @temporary
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue