Skip to content

Commit 625eede

Browse files
committed
Add middleware template
1 parent 61dd331 commit 625eede

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

web/middleware.ts

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
// // This function can be marked `async` if using `await` inside
2+
// import {NextResponse} from 'next/server'
3+
// import {isNativeMobile} from "web/lib/util/webview"
4+
// import {RESERVED_PATHS} from "common/envs/constants";
5+
//
6+
// export function middleware(req: any) {
7+
// // const userAgent = req.headers.get('user-agent') || ''
8+
// const isMobile = isNativeMobile()
9+
//
10+
// console.log(req.nextUrl.pathname)
11+
// const path = req.nextUrl.pathname.slice(1)
12+
// console.log(path)
13+
// if (
14+
// isMobile
15+
// && path.includes('_next')
16+
// && path.includes('.json')
17+
// // !path.includes('/') &&
18+
// // !RESERVED_PATHS.includes(path)
19+
// ) {
20+
// const url = new URL('https://compassmeet.com' + req.nextUrl.pathname)
21+
// // url.pathname = `/mobile${req.nextUrl.pathname}`
22+
// console.log('Rewriting to: ', JSON.stringify(url))
23+
// return NextResponse.redirect(url)
24+
// }
25+
//
26+
// // return NextResponse.next()
27+
// }
28+
//
29+
// // export const config = {
30+
// // matcher: [
31+
// // // Exclude API routes, static files, image optimizations, and .png files
32+
// // '/((?!api|_next/static|_next/image|.*\\.png$).*)',
33+
// // ],
34+
// // }

0 commit comments

Comments
 (0)