A proxy plugin for egg.
This is a plugin for egg. Help you to redriect request from browser to other server api wher CORS.
$ npm i egg-proxy-middleware --save
// config/config.${env}.js
// require
exports.middleware = [
'eggProxy'
];
// config
exports.eggProxy = {
rules: [
{
proxy_location: '/login.aspx', // redirect url
proxy_pass: 'http://www.example.com', // target origin
}
],
body_parse: true,
proxy_timeout: 3000,
gzip: true // default value is true
};
// app/middleware/egg_proxy.js
// wrapper
module.exports = require('egg-proxy-middleware');
framework: koa2
request method: get/post/put/delete
request data format: url/form/multipart
Please open an issue here.