We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent adc40be commit 9372652Copy full SHA for 9372652
src/server.js
@@ -38,6 +38,7 @@ const config = Object.freeze({
38
port: Number(process.env.PORT || 3000),
39
queryLogPath: process.env.QUERY_LOG_PATH,
40
trustProxy: process.env.TRUST_PROXY || 'false',
41
+ cors: process.env.ALLOW_CORS || 'true',
42
});
43
44
const secret = `${config.adminUser}:${config.adminPassword}`;
@@ -184,6 +185,9 @@ async function executeQuery(req, res) {
184
185
186
res.header('Content-Type', result.contentType);
187
res.header('X-Cache', result.cached ? 'hit' : 'miss');
188
+ if (config.cors) {
189
+ res.header('Access-Control-Allow-Origin', '*');
190
+ }
191
res.send(result.body);
192
log({
193
query,
0 commit comments