aklivity / zilla

🦎 A multi-protocol edge & service proxy. Seamlessly interface web apps, IoT clients, & microservices to Apache Kafka® via declaratively defined, stateless APIs.
https://docs.aklivity.io/zilla
Other
540 stars 50 forks source link

Support default welcome path in http-filesystem binding #48

Open jfallows opened 2 years ago

jfallows commented 2 years ago

When request arrives for / then support propagating a default filename, such as index.html.

This can be handled by a routing rule such as:

{
    "type" : "http-filesystem",
    "kind": "proxy",
    "routes":
    [
        {
            "when":
            [
                {
                    "path": "/"
                }
            ],
            "exit": "filesystem_server0",
            "with":
            {
                "path": "index.html"
            }
        },
        {
            "when":
            [
                {
                    "path": "/{path}"
                }
            ],
            "exit": "filesystem_server0",
            "with":
            {
                "path": "${params.path}"
            }
        }
    ]
}

However, it may be more helpful to support the concept of a welcome-path in http-filesystem binding options.

{
    "type" : "http-filesystem",
    "kind": "proxy",
    "options":
    {
        "welcome-path": "/index.html"
    }
    "routes":
    [
        {
            "when":
            [
                {
                    "path": "/{path}"
                }
            ],
            "exit": "filesystem_server0",
            "with":
            {
                "path": "${params.path}"
            }
        }
    ]
}

Then when the / request arrives, it is treated as if it was /index.html.

ankitk-me commented 1 year ago

Hey @jfallows, I would like to give this issue a try. Can you please assign this to me?