mirror of
https://github.com/umami-software/umami.git
synced 2026-02-14 17:45:38 +01:00
Fix issue with force SSL redirects.
This commit is contained in:
parent
128f15092e
commit
3717b0e888
1 changed files with 4 additions and 3 deletions
|
|
@ -1,12 +1,13 @@
|
||||||
import { NextResponse } from 'next/server';
|
import { NextResponse } from 'next/server';
|
||||||
|
|
||||||
function redirectHTTPS(req) {
|
function redirectHTTPS(req) {
|
||||||
|
const host = req.headers.get('host');
|
||||||
if (
|
if (
|
||||||
process.env.FORCE_SSL &&
|
process.env.FORCE_SSL &&
|
||||||
!req.headers.get('host').includes('localhost') &&
|
process.env.NODE_ENV === 'production' &&
|
||||||
req.nextUrl.protocol !== 'https'
|
req.nextUrl.protocol === 'http:'
|
||||||
) {
|
) {
|
||||||
return NextResponse.redirect(`https://${req.headers.get('host')}${req.nextUrl.pathname}`, 301);
|
return NextResponse.redirect(`https://${host}${req.nextUrl.pathname}`, 301);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue