File tree Expand file tree Collapse file tree 4 files changed +42
-32
lines changed Expand file tree Collapse file tree 4 files changed +42
-32
lines changed Original file line number Diff line number Diff line change @@ -2,6 +2,9 @@ import { hstsName, hstsValue } from 'shared'
2
2
import * as fs from 'fs'
3
3
4
4
const contents = `/*
5
+ Cross-Origin-Embedder-Policy: require-corp
6
+ Cross-Origin-Opener-Policy: same-origin
7
+ Cross-Origin-Resource-Policy: cross-origin
5
8
${ hstsName } : ${ hstsValue } `
6
9
7
10
fs . writeFile ( './dist/_headers' , contents , ( err ) => {
Original file line number Diff line number Diff line change @@ -41,6 +41,22 @@ export default defineConfig(({ mode }) => {
41
41
key = fs . readFileSync ( keyPath )
42
42
cert = fs . readFileSync ( certPath )
43
43
}
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
+ }
44
60
return {
45
61
plugins : [
46
62
// if we ever move off this plugin https://github.com/vitejs/vite/issues/2248
@@ -61,21 +77,7 @@ export default defineConfig(({ mode }) => {
61
77
} ) ,
62
78
] ,
63
79
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 ,
80
82
}
81
83
} )
Original file line number Diff line number Diff line change @@ -2,6 +2,9 @@ import { hstsName, hstsValue } from 'shared'
2
2
import * as fs from 'fs'
3
3
4
4
const contents = `/*
5
+ Cross-Origin-Embedder-Policy: require-corp
6
+ Cross-Origin-Opener-Policy: same-origin
7
+ Cross-Origin-Resource-Policy: cross-origin
5
8
${ hstsName } : ${ hstsValue } `
6
9
7
10
fs . writeFile ( './dist/_headers' , contents , ( err ) => {
Original file line number Diff line number Diff line change @@ -42,6 +42,22 @@ export default defineConfig(({ mode }) => {
42
42
key = fs . readFileSync ( keyPath )
43
43
cert = fs . readFileSync ( certPath )
44
44
}
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
+ }
45
61
return {
46
62
plugins : [
47
63
solidPlugin ( ) ,
@@ -63,21 +79,7 @@ export default defineConfig(({ mode }) => {
63
79
} ) ,
64
80
] ,
65
81
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 ,
82
84
}
83
85
} )
You can’t perform that action at this time.
0 commit comments