mirror of
https://github.com/kremalicious/umami.git
synced 2024-06-28 16:57:52 +02:00
Fix issue with force SSL redirects.
This commit is contained in:
parent
128f15092e
commit
3717b0e888
|
@ -1,12 +1,13 @@
|
|||
import { NextResponse } from 'next/server';
|
||||
|
||||
function redirectHTTPS(req) {
|
||||
const host = req.headers.get('host');
|
||||
if (
|
||||
process.env.FORCE_SSL &&
|
||||
!req.headers.get('host').includes('localhost') &&
|
||||
req.nextUrl.protocol !== 'https'
|
||||
process.env.NODE_ENV === 'production' &&
|
||||
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…
Reference in New Issue
Block a user