-
Notifications
You must be signed in to change notification settings - Fork 64
Closed
Milestone
Description
I'd be great if CORS headers returned by the local server were set to the same values used by Twilio Runtime once deployed:
access-control-allow-origin: *
access-control-allow-methods: GET, PUT
access-control-max-age: 3000
This would make for a more consistent testing experience.
Something like this might even possibly suffice, although I'm not sure if Functions should be treated differently than Assets.
--- dist/runtime/server.js
+++ dist/runtime/server.js
@@ -45,6 +45,12 @@
app.use(express_useragent_1.default.express());
app.use(body_parser_1.default.urlencoded({ extended: false }));
app.use(body_parser_1.default.json());
+ app.use(function (req, res, next) {
+ res.header("Access-Control-Allow-Origin", "*");
+ res.header("Access-Control-Allow-Methods", "GET, PUT");
+ res.header("Access-Control-Max-Age", "3000");
+ next();
+ });
app.get('/favicon.ico', (req, res) => {
res.redirect('https://www.twilio.com/marketing/bundles/marketing/img/favicons/favicon.ico');
});