46 lines
		
	
	
		
			1.5 KiB
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			46 lines
		
	
	
		
			1.5 KiB
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
| import { defineConfig } from 'vite'
 | |
| import vue from '@vitejs/plugin-vue'
 | |
| 
 | |
| // https://vitejs.dev/config/
 | |
| export default defineConfig({
 | |
|   plugins: [vue()],
 | |
|   server: {
 | |
|     proxy: {
 | |
|       '/api/volcengine': {
 | |
|         target: 'https://openspeech.bytedance.com',
 | |
|         changeOrigin: true,
 | |
|         rewrite: (path) => path.replace(/^\/api\/volcengine/, '/api/v1/auc'),
 | |
|         secure: false,
 | |
|         configure: (proxy, options) => {
 | |
|           proxy.on('error', (err, req, res) => {
 | |
|             console.log('proxy error', err);
 | |
|           });
 | |
|           proxy.on('proxyReq', (proxyReq, req, res) => {
 | |
|             console.log('Sending Request to the Target:', req.method, req.url);
 | |
|           });
 | |
|           proxy.on('proxyRes', (proxyRes, req, res) => {
 | |
|             console.log('Received Response from the Target:', proxyRes.statusCode, req.url);
 | |
|           });
 | |
|         },
 | |
|       },
 | |
|       '/api/tts': {
 | |
|         target: 'https://openspeech.bytedance.com',
 | |
|         changeOrigin: true,
 | |
|         rewrite: (path) => path.replace(/^\/api\/tts/, '/api/v1/tts'),
 | |
|         secure: false,
 | |
|         configure: (proxy, options) => {
 | |
|           proxy.on('error', (err, req, res) => {
 | |
|             console.log('TTS proxy error', err);
 | |
|           });
 | |
|           proxy.on('proxyReq', (proxyReq, req, res) => {
 | |
|             console.log('TTS Sending Request to the Target:', req.method, req.url);
 | |
|           });
 | |
|           proxy.on('proxyRes', (proxyRes, req, res) => {
 | |
|             console.log('TTS Received Response from the Target:', proxyRes.statusCode, req.url);
 | |
|           });
 | |
|         },
 | |
|       }
 | |
|     }
 | |
|   }
 | |
| }) 
 | 
