Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

211
Views
Proxying Backend Requests In NextJS

I was trying to proxy requests to my backend. Going through docs, I found out that we can add a rewrite() function in config,

module.exports = {
  basePath: "",
  distDir: "build",
  trailingSlash: true,
  images: {
    domains: ["localhost"],
  },
  async rewrites() {
    return {
      beforeFiles: [
        {
          source: "/api/:path*",
          destination: "http://localhost:3001/todos/:path*",
        },
      ],
    };
  },
};

I tried this but it fails .It fires two request to API for one each, here the first request says 308 permanent redirect, and the second request says 404. And thats it, it does not requests the api.

Can someone help me?

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!