Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add option to set webserver listening port #148

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
4 changes: 4 additions & 0 deletions src/http_app.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
5 changes: 5 additions & 0 deletions src/http_app.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down