-
Notifications
You must be signed in to change notification settings - Fork 7.3k
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
HTTP and HTTPS server coexist (IDFGH-8719) #10160
Comments
This could be an issue with same
I suggest that you keep both configurations separate and not over-write one with another. SSL configuration will have the requirement for higher stack size and its better to use values from its default configuration macro. Please try following patch that I created on diff --git examples/protocols/https_server/simple/main/main.c examples/protocols/https_server/simple/main/main.c
index 123fcec711..2dd65775dc 100644
--- examples/protocols/https_server/simple/main/main.c
+++ examples/protocols/https_server/simple/main/main.c
@@ -156,9 +156,15 @@ static httpd_handle_t start_webserver(void)
return NULL;
}
+ httpd_handle_t http_server = NULL;
+ httpd_config_t h_conf = HTTPD_DEFAULT_CONFIG();
+ h_conf.ctrl_port = 32769;
+ ESP_ERROR_CHECK(httpd_start(&http_server, &h_conf));
+
// Set URI handlers
ESP_LOGI(TAG, "Registering URI handlers");
httpd_register_uri_handler(server, &root);
+ httpd_register_uri_handler(http_server, &root);
return server;
} |
Thank you @mahavirj! Changing the port number fixes the issue and both servers now run at the same simultaneously. For the long run; should this be fixed in ESP-IDF or just like this? Also thank you for the tip to keep the config separate, had not spotted that there was a change in the default config. |
@DCSBL We can fix the default configuration in IDF. I will raise an internal fix for this. |
Thank you for the fast solution 🚀! |
For simultaneous HTTP and HTTPS server use-case, default configurations set same control socket port and hence one of the server initialization fails with an error "error in creating control socket". This commit modifies default initializers to use different control socket port in HTTP vs HTTPS server case. Closes espressif/esp-idf#10160 Closes IDFGH-8719
Is your feature request related to a problem?
I want to add an https rest-server, but due to backwards compatibly we require an http server. Is it possible to have an http and an https server at the same time?
Currently when running this code, it does not work:
Describe the solution you'd like.
Allow a http and https server to coexist
Describe alternatives you've considered.
A self-chosen encryption layer over the http-layer, but that is bad practice IMO.
Additional context.
It was tried before here, but is seems any progress has been stalled.
The text was updated successfully, but these errors were encountered: