Doug
Doug

Reputation: 7067

Azure-Functions: How to serve content from the root of domain

Is there any way to serve content out of a root of the domain with an azure function without using a proxy?

I defined a function with a route of / and it appears to be ignored.

I've found a way to use the Proxies (beta), to serve content from the root, but this doesn't work for local development (Proxies appear to only be on Azure, not in the azure-functions-cli).

In various issues I've found a few cryptic references indicating it may be possible, or was possible at one time, but haven't figured out how to.

Upvotes: 2

Views: 460

Answers (1)

Matt Mason
Matt Mason

Reputation: 2726

Not exactly what you're asking for, but my approach would be to use fiddler to emulate Proxies locally.

You can add the following to FiddlerScript:

OnBeforeRequest(oSession: Session) {
...
    if (oSession.host == "127.0.0.1:5050" && oSession.PathAndQuery == "/") {
        oSession.PathAndQuery = "/content";
    }
...
}

This will catch any requests to localhost 127.0.0.1 at the specified port 5050 with root path / and redirect to /content path. You'll need to modify this for your specific port and path.

I'd also encourage you to file an issue on the azure functions cli github

Upvotes: 1

Related Questions