cors on static assets
continuous-integration/drone the build failed
Details
continuous-integration/drone the build failed
Details
parent
4e4b36aab2
commit
b48d4befde
@ -0,0 +1,13 @@
|
||||
// very hacky solution for cors on static assets.
|
||||
const fs = require('fs')
|
||||
const path = require('path')
|
||||
fs.readFile(path.join(__dirname, "workers-site", "index.js"), 'utf8', function (err,data) {
|
||||
if (err) {
|
||||
return console.log(err);
|
||||
}
|
||||
const result = data.replace("new Response(body);\nif (shouldEdgeCache) {", "new Response(body);\nresponse.headers.set(\"Access-Control-Allow-Origin\", \"*\");\nif (shouldEdgeCache) {");
|
||||
|
||||
fs.writeFile(path.join(__dirname, "workers-site", "index.js"), result, 'utf8', function (err) {
|
||||
if (err) return console.log(err);
|
||||
});
|
||||
});
|
Loading…
Reference in new issue