diff --git a/Kconfig b/Kconfig index 59c5a9a8..fc17a4e7 100644 --- a/Kconfig +++ b/Kconfig @@ -30,6 +30,12 @@ config WEBAPP_LOCATION help This parameter helps you relocate the wifimanager to another URL, for instance /wifimanager/ The trailing slash is important and should be included +config WEBAPP_HTTP_PORT + int "Defines the TCP port on which the wifi manager HTTP webserver is listening" + default 80 + help + This parameter helps you relocate the wifimanager webserver from default 80 to another TCP port, for instance 8080 + config DEFAULT_AP_SSID string "Access Point SSID" default "esp32" diff --git a/src/http_app.c b/src/http_app.c index 8dbc40ef..023446b8 100644 --- a/src/http_app.c +++ b/src/http_app.c @@ -428,6 +428,10 @@ void http_app_start(bool lru_purge_enable){ config.uri_match_fn = httpd_uri_match_wildcard; config.lru_purge_enable = lru_purge_enable; + /* set webserver listening tcp port */ + config.server_port = WEBAPP_HTTP_PORT; + ESP_LOGI(TAG, "Setting webserver listening port to: %d", WEBAPP_HTTP_PORT); + /* generate the URLs */ if(http_root_url == NULL){ int root_len = strlen(WEBAPP_LOCATION); diff --git a/src/http_app.h b/src/http_app.h index 53f9472a..b21312e5 100644 --- a/src/http_app.h +++ b/src/http_app.h @@ -48,6 +48,11 @@ extern "C" { */ #define WEBAPP_LOCATION CONFIG_WEBAPP_LOCATION +/** @brief Defines the TCP port on which the webserver is listening + * By default it is set to 80 (standard HTTP port). If you wish to have other webservers + * coexist with WM webapp, you may want to relocate the wifi manager port, for instance 8080 + */ +#define WEBAPP_HTTP_PORT CONFIG_WEBAPP_HTTP_PORT /** * @brief spawns the http server