Page 1 of 1

http_server, server_port overide settings

Posted: Wed Jan 16, 2019 5:09 am
by mikemoy
Has anyone tried to change the server_port default vale of 80 to something else, and have it work?

I have the following and if i leave config.server_port=80 it works just fine, however if i change config.server_port=8080 it wont work.

httpd_config_t config = HTTPD_DEFAULT_CONFIG();
// Lets change this from port 80(default) to 8080
config.server_port = 8080;

Re: http_server, server_port overide settings

Posted: Thu Jan 24, 2019 12:39 pm
by mikemoy
No one has no idea why changing server ports does not work?

Re: http_server, server_port overide settings

Posted: Fri Mar 01, 2019 6:14 am
by ESP_Anurag
Sorry about the delayed reply.

The port configuration works and can be tested using examples/protocols/http_server/advanced_tests. Here's how the configuration is set:

Code: Select all

    httpd_handle_t hd;
    httpd_config_t config = HTTPD_DEFAULT_CONFIG();
    config.server_port = 1234;
    ESP_ERROR_CHECK(httpd_start(&hd, &config) );
The server configuration structure needs to be passed to httpd_start() for this to work (as shown above). Could you please show us the part of your code where this configuration is being set?