diff --git a/lib/Server.js b/lib/Server.js index 6e208128f6..e8af8c87a1 100644 --- a/lib/Server.js +++ b/lib/Server.js @@ -3123,10 +3123,7 @@ class Server { // always allow localhost host, for convenience // allow if value is in allowedHosts if (Array.isArray(allowedHosts) && allowedHosts.length > 0) { - for (let hostIdx = 0; hostIdx < allowedHosts.length; hostIdx++) { - /** @type {string} */ - const allowedHost = allowedHosts[hostIdx]; - + for (const allowedHost of allowedHosts) { if (allowedHost === value) { return true; }