// next js - [...api]
import httpProxy from "http-proxy";
const BLOG_SERVER = process.env.BLOG_SERVER; // https://example.com
export const config = {
api: {
bodyParser: false,
},
}
export default async function Api(req, res) {
const proxy = httpProxy.createProxyServer();
proxy.web(req, res, {
target: BLOG_SERVER
});
proxy.on('error', function (e) {
console.log(e)
});
}
The BLOG_SERVER
has been hosted at heroku and next.js
website has been hosted at vercel
.
When i looked at the next.js
server logs, then the following are printed.