feat/revert like (#429)

This commit is contained in:
Nya Candy
2023-04-26 15:01:39 +01:00
committed by GitHub
parent d078d8986d
commit de213d2fa9
6 changed files with 64 additions and 7 deletions
+6 -4
View File
@@ -4,14 +4,16 @@ import { IS_PROD } from "~/lib/constants"
import { DISCORD_LINK } from "~/lib/env"
// HTTPWhiteListPaths: White list of path for plain http request, no HTTPS redirect
const HTTPWhitelistPaths = [
"/api/healthcheck",
]
const HTTPWhitelistPaths = ["/api/healthcheck"]
export default async function middleware(req: NextRequest) {
const { pathname } = req.nextUrl
if (IS_PROD && req.headers.get("x-forwarded-proto") !== "https" && !HTTPWhitelistPaths.includes(req.nextUrl.pathname)) {
if (
IS_PROD &&
req.headers.get("x-forwarded-proto") !== "https" &&
!HTTPWhitelistPaths.includes(req.nextUrl.pathname)
) {
let cfHttps = false
try {
if (