From 74b046056a5da28060d965050b41643fb91f934f Mon Sep 17 00:00:00 2001 From: Carlos Cesario Date: Wed, 26 Sep 2018 13:58:53 -0300 Subject: [PATCH] Add nginx path_prefix in proxy_pass (#871) * Add path_prefix field for nginx plugin * Add path_prefix ngninx plugin * Update Nginx.xml * Update location.xml * Update index.volt * Update SettingsController.php * review comments --- .../controllers/OPNsense/Nginx/Api/SettingsController.php | 2 +- .../mvc/app/controllers/OPNsense/Nginx/forms/location.xml | 6 ++++++ .../src/opnsense/mvc/app/models/OPNsense/Nginx/Nginx.xml | 4 ++++ .../src/opnsense/mvc/app/views/OPNsense/Nginx/index.volt | 1 + .../opnsense/service/templates/OPNsense/Nginx/location.conf | 5 ++++- 5 files changed, 16 insertions(+), 2 deletions(-) diff --git a/www/nginx/src/opnsense/mvc/app/controllers/OPNsense/Nginx/Api/SettingsController.php b/www/nginx/src/opnsense/mvc/app/controllers/OPNsense/Nginx/Api/SettingsController.php index e675bf31c..f4d0c8c98 100644 --- a/www/nginx/src/opnsense/mvc/app/controllers/OPNsense/Nginx/Api/SettingsController.php +++ b/www/nginx/src/opnsense/mvc/app/controllers/OPNsense/Nginx/Api/SettingsController.php @@ -147,7 +147,7 @@ class SettingsController extends ApiMutableModelControllerBase // Location public function searchlocationAction() { - return $this->searchBase('location', array('description','urlpattern', 'matchtype', 'enable_secrules', 'force_https')); + return $this->searchBase('location', array('description','urlpattern', 'path_prefix', 'matchtype', 'enable_secrules', 'force_https')); } public function getlocationAction($uuid = null) diff --git a/www/nginx/src/opnsense/mvc/app/controllers/OPNsense/Nginx/forms/location.xml b/www/nginx/src/opnsense/mvc/app/controllers/OPNsense/Nginx/forms/location.xml index f89c85182..4ebd04b20 100644 --- a/www/nginx/src/opnsense/mvc/app/controllers/OPNsense/Nginx/forms/location.xml +++ b/www/nginx/src/opnsense/mvc/app/controllers/OPNsense/Nginx/forms/location.xml @@ -61,6 +61,12 @@ Select an upstream to proxy to or connect via FastCGI if chosen. + + location.path_prefix + + text + Define an optional path prefix for this location. It will be prepended to the path so http://www.example.com/index.php will be sent to http://www.example.com/app/index.php on your upstream if you choose "/app" as path prefix. + location.cache_path diff --git a/www/nginx/src/opnsense/mvc/app/models/OPNsense/Nginx/Nginx.xml b/www/nginx/src/opnsense/mvc/app/models/OPNsense/Nginx/Nginx.xml index ee115c95e..1b97ad26a 100644 --- a/www/nginx/src/opnsense/mvc/app/models/OPNsense/Nginx/Nginx.xml +++ b/www/nginx/src/opnsense/mvc/app/models/OPNsense/Nginx/Nginx.xml @@ -205,6 +205,10 @@ N N + + N + /^[^" \t]+$/ +