Created
September 28, 2022 06:32
-
-
Save tmatz/5dd49c4449167b0c96085b165fc7be88 to your computer and use it in GitHub Desktop.
server.proxy via http_proxy with vite.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import react from '@vitejs/plugin-react' | |
import ProxyAgent from 'proxy-agent' | |
import { defineConfig } from 'vite' | |
// https://vitejs.dev/config/ | |
export default defineConfig({ | |
server: { | |
open: true, | |
proxy: { | |
'/api/': { | |
target: 'https://example.com', | |
secure: false, | |
agent: new ProxyAgent(), | |
}, | |
}, | |
}, | |
plugins: [react()], | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment