mirror of
https://github.com/ajnart/homarr.git
synced 2025-11-15 01:36:22 +01:00
🐛 Issue with middleware redirect in docker
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
import { NextRequest, NextResponse } from 'next/server';
|
import { NextRequest, NextResponse } from 'next/server';
|
||||||
import { env } from 'process';
|
import { env } from 'process';
|
||||||
|
|
||||||
|
import { getUrl } from './tools/server/url';
|
||||||
import { client } from './utils/api';
|
import { client } from './utils/api';
|
||||||
|
|
||||||
const skippedUrls = [
|
const skippedUrls = [
|
||||||
@@ -41,7 +42,5 @@ export async function middleware(req: NextRequest) {
|
|||||||
return NextResponse.next();
|
return NextResponse.next();
|
||||||
}
|
}
|
||||||
|
|
||||||
url.pathname = '/onboard';
|
return NextResponse.redirect(getUrl(req) + '/onboard');
|
||||||
|
|
||||||
return NextResponse.redirect(url);
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
import { Button, Center, Stack, Text, Title, createStyles } from '@mantine/core';
|
import { Button, Center, Stack, Text, Title, createStyles } from '@mantine/core';
|
||||||
import { GetServerSidePropsContext } from 'next';
|
import { GetServerSidePropsContext } from 'next';
|
||||||
|
import { useTranslation } from 'next-i18next';
|
||||||
import Head from 'next/head';
|
import Head from 'next/head';
|
||||||
import Image from 'next/image';
|
import Image from 'next/image';
|
||||||
import Link from 'next/link';
|
import Link from 'next/link';
|
||||||
import { useTranslation } from 'next-i18next';
|
|
||||||
import pageNotFoundImage from '~/images/undraw_page_not_found_re_e9o6.svg';
|
import pageNotFoundImage from '~/images/undraw_page_not_found_re_e9o6.svg';
|
||||||
import { pageNotFoundNamespaces } from '~/tools/server/translation-namespaces';
|
import { pageNotFoundNamespaces } from '~/tools/server/translation-namespaces';
|
||||||
|
|
||||||
@@ -24,7 +24,7 @@ export default function Custom404() {
|
|||||||
<Title>{t('title')}</Title>
|
<Title>{t('title')}</Title>
|
||||||
<Text>{t('text')}</Text>
|
<Text>{t('text')}</Text>
|
||||||
|
|
||||||
<Button component={Link} variant="light" href="/">
|
<Button component={Link} variant="light" href="/b">
|
||||||
{t('button')}
|
{t('button')}
|
||||||
</Button>
|
</Button>
|
||||||
</Stack>
|
</Stack>
|
||||||
|
|||||||
6
src/tools/server/url.ts
Normal file
6
src/tools/server/url.ts
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
import { NextRequest } from 'next/server';
|
||||||
|
|
||||||
|
export const getUrl = (req: NextRequest) => {
|
||||||
|
const protocol = req.nextUrl.protocol;
|
||||||
|
return protocol + '//' + req.headers.get('host');
|
||||||
|
};
|
||||||
Reference in New Issue
Block a user