Skip to content

best way to save what you love

api: add cors headers for tunnels

jjfec07d0e1069
diff --git a/api/src/core/api.js b/api/src/core/api.js
index b93ff2ca..fc890ad2 100644
--- a/api/src/core/api.js
+++ b/api/src/core/api.js
@@ -264,6 +264,14 @@ export const runAPI = async (express, app, __dirname, isPrimary = true) => {
}
})
+ app.use('/tunnel', cors({
+ methods: ['GET'],
+ exposedHeaders: [
+ 'Estimated-Content-Length'
+ ],
+ ...corsConfig,
+ }));
+
app.get('/tunnel', apiTunnelLimiter, async (req, res) => {
const id = String(req.query.id);
const exp = String(req.query.exp);