From fdd440ea1dfd9434d57ab8f05c4b461f34eba59a Mon Sep 17 00:00:00 2001 From: Wildan M Date: Thu, 3 Oct 2024 00:08:07 +0700 Subject: [PATCH] Add limit_except and limit_rate --- package-lock.json | 4 ++-- package.json | 2 +- src/executor/nginx.js | 13 ++++++++++++- test/nginx.d/complex.net.conf | 3 +++ 4 files changed, 18 insertions(+), 4 deletions(-) diff --git a/package-lock.json b/package-lock.json index 0a5de39..89eb20d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "domcloud-bridge", - "version": "0.61.0", + "version": "0.62.0", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "domcloud-bridge", - "version": "0.61.0", + "version": "0.62.0", "license": "MIT", "dependencies": { "cli": "^1.0.1", diff --git a/package.json b/package.json index 17e475f..7168fc6 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "domcloud-bridge", - "version": "0.61.0", + "version": "0.62.0", "description": "Deployment runner for DOM Cloud", "main": "app.js", "engines": { diff --git a/src/executor/nginx.js b/src/executor/nginx.js index 1d6e35a..1cabdc2 100644 --- a/src/executor/nginx.js +++ b/src/executor/nginx.js @@ -22,7 +22,8 @@ const passengerKeys = [ ]; const locationKeys = [ "root", "alias", "rewrite", "try_files", "return", "index", - "expires", "allow", "deny", "autoindex", "proxy_pass" + "expires", "allow", "deny", "autoindex", "proxy_pass", + "limit_except", "limit_rate", "limit_rate_after" ]; const sslNames = ["", "off", "always", "on"]; const wwwNames = ["", "off", "always", "on"]; @@ -49,6 +50,16 @@ class NginxExecutor { } else if (/^http:\/\/127\.\d+\.\d+\.\d+:\d+(\$.+|\/.+)?$/.test(config[key])) { node._add(key, config[key]); } + } else if (key == "limit_except") { + node._add(key, config[key], [{ + children: null, + comments: null, + isBlock: false, + isVerbatim: false, + name: "deny", + parent: null, + value: "all", + }]); } else { node._add(key, config[key]); } diff --git a/test/nginx.d/complex.net.conf b/test/nginx.d/complex.net.conf index b749250..316288a 100644 --- a/test/nginx.d/complex.net.conf +++ b/test/nginx.d/complex.net.conf @@ -34,6 +34,9 @@ server { passenger_env_var HTTP_SECURITY_AAAAA 'public'; passenger_env_var HTTP_SECURITY_BBBBB 'public'; passenger_env_var HTTP_SECURITY_LEVEL 'public'; + limit_except GET POST { + deny all; + } } location ~ \.php(/|$) { try_files $uri =404;