Is something like thiss possible with with caddy (nginx example inside)

    location ~ ^/[A-Za-z0-9_-]+\.[A-Za-z0-7_-]+$ {       
        root /srv/filehost;  
    }

So pretty much use a different root for a certain rexeg.

What I want to do is files in filehost/, for example filehost/image.png to show up as website.com/image.png for the user

1 Like

Not exactly, but it simpler and almost the same:

website.com
root /srv/filehost

That regex doesn’t make a whole lot of sense to me, it matches practically every request with a dot in the path. You could probably use rewrite if you need to get fancy with your regex.

The thing is, I also host different pages, like /srv/somethingelse/index.html, I’m pretty sure setting my root to /srv/filehost would make that not work right? The regex makes all files in filehost/ (typically S0dc.png, so a 4 letter random string with an extension) show up like website.com/S0dc.png instead of website.com/filehost/S0dc.png, which is what I want.

I tried various rewrites and proxies and whatnot and could get nothing similar, that’s what I’m asking here.

Well, Caddy is structured around sites. Why not put your site in one folder?

because dumping everything in the root is messy, especially if everything is thousands of files. that’s the reason I put these “filehost” files in a separate directory, instead of symlinkling or having them all in root.

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