Fix CORS in service worker (#342)
* Add crossOrigin to generated <script> elements if CDN is used * Add CORS headers to darkmode.js --------- Co-authored-by: ekzyis <ek@stacker.news>
This commit is contained in:
parent
69f6f63b9c
commit
f417092107
|
@ -30,12 +30,23 @@ module.exports = withPlausibleProxy()({
|
|||
generateBuildId: isProd ? async () => commitHash : undefined,
|
||||
// Use the CDN in production and localhost for development.
|
||||
assetPrefix: isProd ? 'https://a.stacker.news' : undefined,
|
||||
crossOrigin: isProd ? 'anonymous' : undefined,
|
||||
async headers () {
|
||||
return [
|
||||
{
|
||||
source: '/_next/:asset*',
|
||||
headers: corsHeaders
|
||||
},
|
||||
{
|
||||
source: '/darkmode.js',
|
||||
headers: [
|
||||
...corsHeaders,
|
||||
{
|
||||
key: 'Cache-Control',
|
||||
value: 'public, max-age=31536000, immutable'
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
source: '/Lightningvolt-xoqm.ttf',
|
||||
headers: [
|
||||
|
|
Loading…
Reference in New Issue