vite.config.js 675 B

123456789101112131415161718192021222324252627
  1. import { defineConfig } from 'vite';
  2. const host = 'http://172.16.1.59';
  3. const o={
  4. target: host,
  5. changeOrigin: true,
  6. onProxyRes: (proxyRes, req, res) => {
  7. const cookie = proxyRes.headers['set-cookie'];
  8. if (cookie && cookie[0]){
  9. const host = req.headers['host'].split(':')[0];
  10. cookie[0] = cookie[0].replace(/(domain=)([^;]+)/, '$1'+host);
  11. }
  12. }
  13. }
  14. export default defineConfig({
  15. // assetsInclude: ['**/*.html'],
  16. server: {
  17. proxy: {
  18. '/jaxrs': o,
  19. '/x_program_center': o,
  20. '/x_desktop': o
  21. },
  22. host: true,
  23. sourcemap: true
  24. },
  25. base: './'
  26. })