Compare commits
2 Commits
614c9b7821
...
a995ba76bc
Author | SHA1 | Date | |
---|---|---|---|
a995ba76bc
|
|||
fdacb09bde
|
@@ -1,4 +1,4 @@
|
|||||||
FROM node:10-alpine
|
FROM node:24-alpine
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
|
4
index.js
4
index.js
@@ -25,12 +25,12 @@ http.createServer((req, response) => {
|
|||||||
if(!remoteURL.hostname || remoteURL.hostname === 'localhost') return response.end();
|
if(!remoteURL.hostname || remoteURL.hostname === 'localhost') return response.end();
|
||||||
|
|
||||||
if(blockList.some(b => remoteURL.hostname == b || remoteURL.hostname.endsWith("." + b))) {
|
if(blockList.some(b => remoteURL.hostname == b || remoteURL.hostname.endsWith("." + b))) {
|
||||||
console.log("Domain is in blocklist")
|
console.log(`Domain '${remoteURL.hostname}' is in blocklist`)
|
||||||
response.writeHead(403);
|
response.writeHead(403);
|
||||||
return response.end();
|
return response.end();
|
||||||
}
|
}
|
||||||
if(allowList.length > 0 && !allowList.some(b => remoteURL.hostname == b || remoteURL.hostname.endsWith("." + b))) {
|
if(allowList.length > 0 && !allowList.some(b => remoteURL.hostname == b || remoteURL.hostname.endsWith("." + b))) {
|
||||||
console.log("Domain is not in allowlist")
|
console.log(`Domain '${remoteURL.hostname}' is not in allowlist`)
|
||||||
response.writeHead(403);
|
response.writeHead(403);
|
||||||
return response.end();
|
return response.end();
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user