Skip to content

Instantly share code, notes, and snippets.

@pkrisko
Last active August 21, 2020 13:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pkrisko/ceaca134fd9f6efdfb696a8c97a3e91f to your computer and use it in GitHub Desktop.
Save pkrisko/ceaca134fd9f6efdfb696a8c97a3e91f to your computer and use it in GitHub Desktop.
Proxy all /api traffic from your next.js backend to whatever you want.
import { createProxyMiddleware } from 'http-proxy-middleware';
export default createProxyMiddleware({
target: process.env.FIREBASE_API_DOMAIN,
changeOrigin: true,
pathRewrite: {
'^/api': '/',
},
prependPath: true,
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment