Rewrite Zammad API calls in config rather than middleware

This commit is contained in:
Darren Clarke 2024-08-28 10:06:43 +02:00
parent f0e8e20c24
commit 781f8c380a
3 changed files with 17 additions and 5 deletions

View file

@ -6,7 +6,7 @@ const nextConfig = {
"@link-stack/ui",
"@link-stack/bridge-common",
"@link-stack/bridge-ui",
"mui-chips-input"
"mui-chips-input",
],
publicRuntimeConfig: {
linkURL: process.env.LINK_URL ?? "http://localhost:3000",
@ -14,6 +14,20 @@ const nextConfig = {
labelStudioURL: process.env.LABEL_STUDIO_URL ?? "http://localhost:8006",
muiLicenseKey: process.env.MUI_LICENSE_KEY ?? "",
},
rewrites: async () => {
return {
beforeFiles: [
{
source: "/api/v1/:path*",
destination: `${process.env.ZAMMAD_URL}/api/v1/:path*`,
},
{
source: "/ws",
destination: `${process.env.ZAMMAD_URL}/ws`,
},
],
};
},
};
export default nextConfig;