Using try_files with reverse_proxy

1. The problem I’m having:

I’m using caddy as a proxy server. I want to know if there is any way that I can use try_files so that it will look for index.html on my proxy server.

2. My Caddy File

*.bitsy.test {
    reverse_proxy https://bitsy.ams3.digitaloceanspaces.com {
        rewrite /{http.request.host.labels.2}{uri}
        header_up Host "bitsy"
    }
}

3. Caddy version:

v2.7.5

a. System environment:

Linux

try_files is looking for files on disk. If Caddy doesn’t have access to the files, it can’t be used.

1 Like

Thanks for getting back to me. Is there any workaround by using if else statements?

I don’t understand what you mean. Like I said, unless Caddy has direct access to the files, then it can’t make decisions on whether a request path matches a file that exists… because to Caddy, the files don’t exist because it can’t see them.

Caddy doesn’t have if/else, it has request matchers.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.