Skip to content

Redirect "/" to "/.www/index.html" #14

@idolpx

Description

@idolpx

I want to use "/" as root for WebDAV but I would like to rewrite the URL for "/" to "/.www/index.html" so my web configuration app will be accessible by default.

#if WEBSERVER_HAS_HOOK
WebServer::HookFunction hookWebDAVForWebserver(const String& davRootDir, ESPWebDAVCore& dav)
{
    return [&dav, davRootDir](const String & method, const String & url, WiFiClient * client, WebServer::ContentTypeFunction contentType)
    {
        if (url == "/")
        {
            DBG_PRINT("WE ARE AT ROOT!");
            url = "/.www/index.html";
        }

        if (url.indexOf(".www") != 0)
        {
            DBG_PRINT("CLIENT_REQUEST_CAN_CONTINUE, %s is not seen in %s", davRootDir.c_str(), url.c_str());
            return WebServer::CLIENT_REQUEST_CAN_CONTINUE;
        }

This does not work. Is there a way to do this?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions