File tree Expand file tree Collapse file tree 5 files changed +15
-44
lines changed
Expand file tree Collapse file tree 5 files changed +15
-44
lines changed Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -12,15 +12,6 @@ export default defineEventHandler((event) => {
1212
1313 const headers = event . node . req . headers
1414
15- // useNitroApp().logger.info('http', {
16- // method,
17- // url,
18- // status,
19- // duration,
20- // time: now,
21- // headers,
22- // })
23-
2415 useNitroApp ( ) . db . collection ( 'http-logs' ) . insertOne ( {
2516 method,
2617 url,
Original file line number Diff line number Diff line change 1+ import { createError , defineEventHandler } from '#imports'
2+ import { COUNTRY_HEADER_NAME } from '~~/server/tracking/const'
3+
4+ const blockedCountries = [ "RU" , "BY" ]
5+
6+ export default defineEventHandler ( ( event ) => {
7+ const country = event . node . req . headers [ COUNTRY_HEADER_NAME ] as string
8+
9+ if ( blockedCountries . includes ( country ) ) {
10+ throw createError ( {
11+ statusCode : 403 ,
12+ statusMessage : 'Forbidden'
13+ } )
14+ }
15+ } )
File renamed without changes.
File renamed without changes.
You can’t perform that action at this time.
0 commit comments