Esp_http_server.h has no wildcard


I am migrating my code that I did using ESP-IDF to the Platformio ide.

When trying to migrate my web server code I encounter a problem.

The WildCards function is not implemented in the esp_http_server.h library.

Is there any way to use WildCards?

My web server code is the one in the image. The underlined is what is not in the library.Captura1

Thanks :grinning:

The function httpd_uri_match_wildcard is part of ESP-IDF v3.3 and should be available in PlatformIO.

Do you include the header file esp_http_server.h? What’s the exact error message?

BTW: Code should be added as text. That way it’s possible to search for it, and it can be easily copied to reproduce a problem. That’s not possible with code in images.

1 Like

Hi @manuelbl,

This is my example code.

#include <WiFi.h>
#include "esp_http_server.h"

const char* ssid = "....";
const char* password = "...";

static esp_err_t on_url_hit(httpd_req_t *req)
    ESP_LOGI(TAG, "url %s was hit", req->uri);
    char *message = "hello world!";
    httpd_resp_send(req, message, strlen(message));
    return ESP_OK;

void setup(void) {
  WiFi.begin(ssid, password);

  // Wait for connection
  while (WiFi.status() != WL_CONNECTED) {
  Serial.print("Connected to ");
  Serial.print("IP address: ");

  httpd_handle_t server = NULL;
  httpd_config_t config = HTTPD_DEFAULT_CONFIG();
  config.uri_match_fn = httpd_uri_match_wildcard;

  if (httpd_start(&server, &config) != ESP_OK){
      Serial.println("COULD NOT START SERVER");
  httpd_uri_t first_end_point_config = {
      .uri = "/",
      .method = HTTP_GET,
      .handler = on_url_hit};
  httpd_register_uri_handler(server, &first_end_point_config);
  Serial.println("HTTP server started");

void loop(void) {

The errors that it marks are.

src\main.cpp:36:10: error: ‘httpd_config_t {aka struct httpd_config}’ has no member named ‘uri_match_fn’
config.uri_match_fn = httpd_uri_match_wildcard;
src\main.cpp:36:25: error: ‘httpd_uri_match_wildcard’ was not declared in this scope config.uri_match_fn = httpd_uri_match_wildcard;`

I already looked in the esp_http_server library at the address

c: /.../.platformio/packages/framework-arduinoespressif32/tools/sdk/include /esp_http_server.h

and the WildCard member function is not implemented

any ideas?

Thanks :smiley:

Can you show your platformio.ini file? It seems that your main change is not the build system (from ESP-IDF make/cmake to PlatformIO) but rather the framework (ESP-IDF to Arduino).

It is de basic one.

platform = espressif32
board = esp32dev
framework = arduino

The latest productive Arduino core for ESP32 (version 1.0.4) is based on ESP-IDF 3.2 and does not yet contain uri_match_fn and httpd_uri_match_wildcard.

The upgrade to ESP-IDF 3.3 is underway and once it’s officially released, PlatformIO will likely upgrade as well.

1 Like

If you’re adventurous, you can add this line to platformio.ini:

platform_packages = framework-arduinoespressif32 @

You will then be using the Arduino core under development, which includes the functions you’re looking for.

1 Like


The two data are very useful to me. If I continue to develop in the stable version I will know what documentation to refer to; In case I want to try some of the new features, you also taught me how to do it.

Thank you very much @manuelbl :grin:

Perhaps a stupid question here… but why are you specifying framework = arduino if you want to use the ESP-IDF? If you specify framework = espidf, you will be able to use ESP-IDF 3.3 LTS, which should support that wildcard function. But perhaps I’m missing something here?

Edit: OK, had a closer look at your full code sample, it looks like you’re using Arduino code and some ESP-IDF functions… nevermind! :man_facepalming:

Hi @pfeerick,

Yes, I am using the Arduino sketch to be able to use classes and objects more easily. Also to take advantage of the large number of libraries made for Arduino. :innocent:

1 Like