MCPcopy Create free account
hub / github.com/BrasilAPI/BrasilAPI / firewall

Function firewall

middlewares/firewall.js:7–16  ·  view source on GitHub ↗
(request, response, next)

Source from the content-addressed store, hash-verified

5
6// https://github.com/filipedeschamps/tabnews.com.br/blob/53482fa8d15c273e9dcda80242eaba4d9f37c9a9/middleware.public.js#L13
7export default function firewall(request, response, next) {
8 if (isProduction && !isRequestFromCloudflare(request)) {
9 throw new UnauthorizedError({
10 message:
11 'Host não autorizado. Por favor, acesse https://brasilapi.com.br',
12 });
13 }
14
15 return next();
16}

Callers

nothing calls this directly

Calls 1

isRequestFromCloudflareFunction · 0.90

Tested by

no test coverage detected