Next.js Discord

Discord Forum

Rewrite to my AI api gets "socket hang up"

Unanswered
Stonechat posted this in #help-forum
Open in Discord
StonechatOP
I have an rewrite route so I can connect to my text generation AI. However if the AI takes longer the nextjs server just hangs up. How do i fix that?

import { Rewrite } from './node_modules/next/dist/lib/load-custom-routes.d';
import type { NextConfig } from "next";

const nextConfig: NextConfig = {
  async rewrites() {
    return [
      {
        source: "/api/:path*",
        destination: "http://localhost:8080/:path*",
        
      },
    ];
  },
  skipTrailingSlashRedirect: true
};

export default nextConfig;

0 Replies