vite.config.js 819 B

123456789101112131415161718192021222324252627
  1. import { defineConfig } from 'vite'
  2. import vue from '@vitejs/plugin-vue'
  3. export default defineConfig({
  4. plugins: [vue()],
  5. server: {
  6. proxy: {
  7. '/api': {
  8. target: 'https://cinema.kolei.ru',
  9. changeOrigin: true,
  10. secure: false,
  11. rewrite: (path) => path.replace(/^\/api/, '/api'),
  12. configure: (proxy, _options) => {
  13. proxy.on('error', (err, _req, _res) => {
  14. console.log('proxy error', err);
  15. });
  16. proxy.on('proxyReq', (proxyReq, req, _res) => {
  17. console.log('Sending Request to the Target:', req.method, req.url);
  18. });
  19. proxy.on('proxyRes', (proxyRes, req, _res) => {
  20. console.log('Received Response from the Target:', proxyRes.statusCode, req.url);
  21. });
  22. },
  23. }
  24. }
  25. }
  26. })