Skip to content

Commit 2986639

Browse files
committed
update headers
1 parent b3a61df commit 2986639

File tree

4 files changed

+42
-32
lines changed

4 files changed

+42
-32
lines changed

app-ugc/buildHeaders.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@ import { hstsName, hstsValue } from 'shared'
22
import * as fs from 'fs'
33

44
const contents = `/*
5+
Cross-Origin-Embedder-Policy: require-corp
6+
Cross-Origin-Opener-Policy: same-origin
7+
Cross-Origin-Resource-Policy: cross-origin
58
${hstsName}: ${hstsValue}`
69

710
fs.writeFile('./dist/_headers', contents, (err) => {

app-ugc/vite.config.ts

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,22 @@ export default defineConfig(({ mode }) => {
4141
key = fs.readFileSync(keyPath)
4242
cert = fs.readFileSync(certPath)
4343
}
44+
const serverOptions = {
45+
headers: {
46+
// eslint-disable-next-line @typescript-eslint/naming-convention
47+
'Cross-Origin-Opener-Policy': 'same-origin',
48+
// eslint-disable-next-line @typescript-eslint/naming-convention
49+
'Cross-Origin-Embedder-Policy': 'require-corp',
50+
// eslint-disable-next-line @typescript-eslint/naming-convention
51+
'Cross-Origin-Resource-Policy': 'cross-origin',
52+
},
53+
port: 3015,
54+
strictPort: true,
55+
https: {
56+
key,
57+
cert,
58+
},
59+
}
4460
return {
4561
plugins: [
4662
// if we ever move off this plugin https://github.com/vitejs/vite/issues/2248
@@ -61,21 +77,7 @@ export default defineConfig(({ mode }) => {
6177
}),
6278
],
6379
build,
64-
server: {
65-
port: 3015,
66-
strictPort: true,
67-
https: {
68-
key,
69-
cert,
70-
},
71-
},
72-
preview: {
73-
port: 3015,
74-
strictPort: true,
75-
https: {
76-
key,
77-
cert,
78-
},
79-
},
80+
server: serverOptions,
81+
preview: serverOptions,
8082
}
8183
})

hub-ugc/buildHeaders.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@ import { hstsName, hstsValue } from 'shared'
22
import * as fs from 'fs'
33

44
const contents = `/*
5+
Cross-Origin-Embedder-Policy: require-corp
6+
Cross-Origin-Opener-Policy: same-origin
7+
Cross-Origin-Resource-Policy: cross-origin
58
${hstsName}: ${hstsValue}`
69

710
fs.writeFile('./dist/_headers', contents, (err) => {

hub-ugc/vite.config.ts

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,22 @@ export default defineConfig(({ mode }) => {
4242
key = fs.readFileSync(keyPath)
4343
cert = fs.readFileSync(certPath)
4444
}
45+
const serverOptions = {
46+
headers: {
47+
// eslint-disable-next-line @typescript-eslint/naming-convention
48+
'Cross-Origin-Opener-Policy': 'same-origin',
49+
// eslint-disable-next-line @typescript-eslint/naming-convention
50+
'Cross-Origin-Embedder-Policy': 'require-corp',
51+
// eslint-disable-next-line @typescript-eslint/naming-convention
52+
'Cross-Origin-Resource-Policy': 'cross-origin',
53+
},
54+
port: 3016,
55+
strictPort: true,
56+
https: {
57+
key,
58+
cert,
59+
},
60+
}
4561
return {
4662
plugins: [
4763
solidPlugin(),
@@ -63,21 +79,7 @@ export default defineConfig(({ mode }) => {
6379
}),
6480
],
6581
build,
66-
server: {
67-
port: 3016,
68-
strictPort: true,
69-
https: {
70-
key,
71-
cert,
72-
},
73-
},
74-
preview: {
75-
port: 3016,
76-
strictPort: true,
77-
https: {
78-
key,
79-
cert,
80-
},
81-
},
82+
server: serverOptions,
83+
preview: serverOptions,
8284
}
8385
})

0 commit comments

Comments
 (0)