Merge pull request #2280 from micaelmz/feature/wildcard-for-websocket-allowed-hosts

feat: add wildcard "*" to allow all hosts to connect via websocket
This commit is contained in:
Davidson Gomes
2025-12-05 10:59:03 -03:00
committed by GitHub

View File

@@ -33,7 +33,8 @@ export class WebsocketController extends EventController implements EventControl
const { remoteAddress } = req.socket;
const websocketConfig = configService.get<Websocket>('WEBSOCKET');
const allowedHosts = websocketConfig.ALLOWED_HOSTS || '127.0.0.1,::1,::ffff:127.0.0.1';
const isAllowedHost = allowedHosts
const allowAllHosts = allowedHosts.trim() === '*';
const isAllowedHost = allowAllHosts || allowedHosts
.split(',')
.map((h) => h.trim())
.includes(remoteAddress);