mirror of
https://github.com/HeyPuter/puter
synced 2024-11-14 22:06:00 +00:00
Update WebServerService.js
This commit is contained in:
parent
fd4e2f59dc
commit
42d85abfc2
@ -298,8 +298,8 @@ class WebServerService extends BaseService {
|
||||
// Parse the Host header to isolate the hostname (strip out port if present)
|
||||
const hostName = hostHeader.split(':')[0].trim().toLowerCase();
|
||||
|
||||
// Check if the hostname matches any of the allowed domains
|
||||
if (allowedDomains.some(allowedDomain => hostName.endsWith(allowedDomain))) {
|
||||
// Check if the hostname matches any of the allowed domains or is a subdomain of an allowed domain
|
||||
if (allowedDomains.some(allowedDomain => hostName === allowedDomain || hostName.endsWith('.' + allowedDomain))) {
|
||||
next(); // Proceed if the host is valid
|
||||
} else {
|
||||
return res.status(400).send('Invalid Host header.');
|
||||
|
Loading…
Reference in New Issue
Block a user