Set up vite proxy server, remove CORS hack
This commit is contained in:
Binary file not shown.
|
After Width: | Height: | Size: 15 KiB |
@ -37,8 +37,8 @@ export function App() {
|
||||
return (
|
||||
<QueryClientProvider client={queryClient}>
|
||||
<h1>Hey Team! 👋</h1>
|
||||
<Example api="http://localhost:8080/"/>
|
||||
<Example api="http://localhost:3000/"/>
|
||||
<Example api="/api/golang"/>
|
||||
<Example api="/api/node"/>
|
||||
</QueryClientProvider>
|
||||
);
|
||||
}
|
||||
|
||||
@ -1,7 +1,28 @@
|
||||
import { defineConfig } from 'vite'
|
||||
import react from '@vitejs/plugin-react-swc'
|
||||
import { defineConfig } from 'vite';
|
||||
import react from '@vitejs/plugin-react-swc';
|
||||
import dns from 'dns';
|
||||
|
||||
dns.setDefaultResultOrder('verbatim');
|
||||
|
||||
// https://vitejs.dev/config/
|
||||
export default defineConfig({
|
||||
plugins: [react()],
|
||||
})
|
||||
server: {
|
||||
proxy: {
|
||||
'/api/golang': {
|
||||
// TODO: Make this inside and outside of docker (e.g. localhost vs api-golang)
|
||||
target: 'http://api-golang:8080',
|
||||
changeOrigin: true,
|
||||
rewrite: (path) => path.replace(/^\/api\/golang/, ''),
|
||||
secure: false,
|
||||
},
|
||||
'/api/node': {
|
||||
// TODO: Make this inside and outside of docker (e.g. localhost vs api-node)
|
||||
target: 'http://api-node:3000',
|
||||
changeOrigin: true,
|
||||
rewrite: (path) => path.replace(/^\/api\/node/, ''),
|
||||
secure: false,
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user