Modern.js provides a way to configure the development proxy in dev.server.proxy. For example, to proxy the local interface to an online address:
import { defineConfig } from '@modern-js/app-tools';
export default defineConfig({
dev: {
server: {
proxy: {
'/go/api': 'http://www.example.com/',
},
},
},
});When accessing http://localhost:8080/go/api, the response content will be returned from http://www.example.com/.
For configuration format, please refer to: http-proxy-middleware.