Commit e1e0900 1 parent 90f51fb commit e1e0900 Copy full SHA for e1e0900
File tree 1 file changed +4
-11
lines changed
1 file changed +4
-11
lines changed Original file line number Diff line number Diff line change @@ -2,15 +2,6 @@ import type { NextRequest } from 'next/server'
2
2
import { NextResponse } from 'next/server'
3
3
import { handleRewrite } from 'server/rewrites'
4
4
5
- function getRandomishId ( ) {
6
- const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'
7
- let result = ''
8
- for ( let i = 0 ; i < 10 ; i ++ ) {
9
- result += chars . charAt ( Math . floor ( Math . random ( ) * chars . length ) )
10
- }
11
- return result
12
- }
13
-
14
5
export function middleware ( request : NextRequest ) {
15
6
const allowedOrigins = process . env . ALLOWED_ORIGINS ?. split ( ',' ) || [ ]
16
7
@@ -22,8 +13,10 @@ export function middleware(request: NextRequest) {
22
13
23
14
const response = NextResponse . next ( )
24
15
const origin = request . headers . get ( 'origin' ) || ''
25
- const userAgentHeader = request . headers . get ( 'user-agent' ) || ''
26
- request . headers . set ( 'user-agent' , `${ userAgentHeader } Summer.fi/${ getRandomishId ( ) } ` )
16
+
17
+ if ( request . headers . get ( 'x-now-route-matches' ) ) {
18
+ request . headers . delete ( 'x-now-route-matches' )
19
+ }
27
20
28
21
// If the origin is in the ALLOWED_ORIGINS env, add it to the Access-Control-Allow-Origin header
29
22
if ( allowedOrigins . includes ( origin ) ) {
You can’t perform that action at this time.
0 commit comments