added backend reverse proxy to next to directly fetch data from client
This commit is contained in:
parent
e06753fb24
commit
cf3c34fb2f
@ -1,13 +1,23 @@
|
||||
import type { NextConfig } from "next";
|
||||
import createNextIntlPlugin from 'next-intl/plugin';
|
||||
import createNextIntlPlugin from "next-intl/plugin";
|
||||
|
||||
const withNextIntl = createNextIntlPlugin();
|
||||
|
||||
const nextConfig: NextConfig = {
|
||||
/* config options here */
|
||||
sassOptions: {
|
||||
silenceDeprecations: ['legacy-js-api'],
|
||||
}
|
||||
silenceDeprecations: ["legacy-js-api"],
|
||||
},
|
||||
async rewrites() {
|
||||
return [
|
||||
{
|
||||
source: "/api/:path*",
|
||||
destination: `${process.env.API_SERVER}/:path*`, // Zielserver aus Umgebungsvariable
|
||||
},
|
||||
];
|
||||
},
|
||||
// This is required to support PostHog trailing slash API requests
|
||||
skipTrailingSlashRedirect: true,
|
||||
};
|
||||
|
||||
export default withNextIntl(nextConfig);
|
||||
|
@ -1,20 +1,20 @@
|
||||
import {createNavigation} from 'next-intl/navigation';
|
||||
import {defineRouting} from 'next-intl/routing';
|
||||
import { createNavigation } from "next-intl/navigation";
|
||||
import { defineRouting } from "next-intl/routing";
|
||||
|
||||
export const routing = defineRouting({
|
||||
locales: ['en', 'de'],
|
||||
defaultLocale: 'en',
|
||||
locales: ["en", "de"],
|
||||
defaultLocale: "en",
|
||||
pathnames: {
|
||||
'/': '/',
|
||||
'/pathnames': {
|
||||
en: '/pathnames',
|
||||
de: '/pfadnamen'
|
||||
}
|
||||
}
|
||||
"/": "/",
|
||||
"/pathnames": {
|
||||
en: "/pathnames",
|
||||
de: "/pfadnamen",
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
export type Pathnames = keyof typeof routing.pathnames;
|
||||
export type Locale = (typeof routing.locales)[number];
|
||||
|
||||
export const {Link, getPathname, redirect, usePathname, useRouter} =
|
||||
export const { Link, getPathname, redirect, usePathname, useRouter } =
|
||||
createNavigation(routing);
|
@ -1,5 +1,5 @@
|
||||
import createMiddleware from 'next-intl/middleware';
|
||||
import {routing} from './i18n/routing';
|
||||
import createMiddleware from "next-intl/middleware";
|
||||
import { routing } from "./i18n/routing";
|
||||
|
||||
export default createMiddleware(routing);
|
||||
|
||||
@ -7,14 +7,17 @@ export const config = {
|
||||
// Match only internationalized pathnames
|
||||
matcher: [
|
||||
// Enable a redirect to a matching locale at the root
|
||||
'/',
|
||||
"/",
|
||||
|
||||
// Set a cookie to remember the previous locale for
|
||||
// all requests that have a locale prefix
|
||||
'/(de|en)/:path*',
|
||||
"/(de|en)/:path*",
|
||||
|
||||
// Enable redirects that add missing locales
|
||||
// (e.g. `/pathnames` -> `/en/pathnames`)
|
||||
'/((?!_next|_vercel|.*\\..*).*)'
|
||||
]
|
||||
//'/((?!_next|_vercel|.*\\..*).*)'
|
||||
|
||||
// Ausschließen von API-Routen
|
||||
"/((?!api|_next|_vercel|.*\\..*).*)",
|
||||
],
|
||||
};
|
Loading…
x
Reference in New Issue
Block a user