Fix double CORS header #1

This commit is contained in:
Wietse Wind
2023-10-09 01:17:51 +02:00
parent f2b9aa18d6
commit 788b57f6d5
2 changed files with 8 additions and 3 deletions

View File

@@ -63,7 +63,6 @@ if (!wss) {
// })
app.use('/',
cors(),
(req, res, next) => {
if (process.env?.TELEMETRY === 'YES' && !req.url.match(/health/)) {
const telemetryData = {
@@ -81,7 +80,13 @@ if (!wss) {
if (req.url.split('?')?.[0].match(/\.json$/i)) {
res.setHeader('content-type', 'application/json')
}
next()
// Sent by nginx used with docker-compose
if (req.headers?.['x-no-cors']) {
next()
} else {
cors()(req, res, next)
}
},
function renderHomepage(req, res, next) {
// res.setHeader('content-type', 'text/html')