89 lines
3.1 KiB
JavaScript
89 lines
3.1 KiB
JavaScript
import {fileURLToPath, URL} from 'node:url'
|
|
|
|
import {defineConfig} from 'vite'
|
|
import vue from '@vitejs/plugin-vue'
|
|
|
|
export default defineConfig({
|
|
plugins: [vue()],
|
|
resolve: {
|
|
alias: {
|
|
'@': fileURLToPath(new URL('./src', import.meta.url))
|
|
}
|
|
},
|
|
server: {
|
|
host: true,
|
|
cors: true,
|
|
headers: {
|
|
//allow all origins
|
|
'Access-Control-Allow-Methods': 'GET, POST, PUT, DELETE, OPTIONS',
|
|
'Access-Control-Allow-Headers': 'Origin, Content-Type, X-Auth-Token, Authorization, Accept, charset, boundary, Content-Length',
|
|
'Access-Control-Allow-Credentials': 'true',
|
|
'Access-Control-Max-Age': '86400',
|
|
'Content-Security-Policy': 'default-src \'self\';'
|
|
+ ' script-src \'self\' \'wasm-unsafe-eval\';'
|
|
+ ' style-src \'self\' \'unsafe-inline\';'
|
|
+ ' img-src \'self\' https://* data:;'
|
|
+ ' connect-src * data:', // TODO: change * to https://* for production
|
|
},
|
|
https: {
|
|
key: fs.readFileSync('.local/privkey.pem'),
|
|
cert: fs.readFileSync('.local/fullchain.pem')
|
|
},
|
|
proxy: {
|
|
'^/api/': {
|
|
target: "http://127.0.0.1:8000/",
|
|
headers: {
|
|
'Host': 'localhost:5173',
|
|
'Origin': 'https://localhost:5173',
|
|
'X-Forwarded-Host': 'localhost:5173',
|
|
'X-Forwarded-Proto': 'https',
|
|
}
|
|
},
|
|
'^/auth/': {
|
|
target: "http://127.0.0.1:8000/",
|
|
headers: {
|
|
'Host': 'localhost:5173',
|
|
'Origin': 'https://localhost:5173',
|
|
'X-Forwarded-Host': 'localhost:5173',
|
|
'X-Forwarded-Proto': 'https',
|
|
}
|
|
// target: "https://toolshed.j3d1.de:8000/",
|
|
// secure: false,
|
|
// },
|
|
// '^/docs/': {
|
|
// target: "https://toolshed.j3d1.de:8000/",
|
|
// },
|
|
// '^/static/': {
|
|
// target: "https://toolshed.j3d1.de:8000/",
|
|
//>>>>>>> busti/proto/frontend
|
|
},
|
|
'^/media/': {
|
|
target: "http://127.0.0.1:8000/",
|
|
headers: {
|
|
'Host': 'localhost:5173',
|
|
'Origin': 'https://localhost:5173',
|
|
'X-Forwarded-Host': 'localhost:5173',
|
|
'X-Forwarded-Proto': 'https',
|
|
}
|
|
},
|
|
'^/docs/': {
|
|
target: "http://127.0.0.1:8000/",
|
|
},
|
|
'^/static/': {
|
|
target: "http://127.0.0.1:8000/",
|
|
},
|
|
'^/wiki/': {
|
|
target: "http://127.0.0.1:8080/",
|
|
rewrite: (path) => path.replace(/^\/wiki/, ''),
|
|
},
|
|
'^/livereload/': {
|
|
target: "http://127.0.0.1:8080/",
|
|
}
|
|
}
|
|
},
|
|
test: {
|
|
include: ['src/tests/**/*.js'],
|
|
globals: true,
|
|
environment: "jsdom"
|
|
}
|
|
})
|