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