Help with rewrite!

(Diego Suarez) #1

Hello everyone,

I’m trying to mimic this from nginx:

  location /paperclip/ {
    alias /mnt/volume/paperclip/;
  }

I read that caddy doesn’t really go outside of the root dir so my next thought was to create a symlink inside root to that location so i did:

ln -s /mnt/volume/paperclip/ paperclip

So now im just trying to figure out the rewrite to get my images back xD (Already tried a bunch of different rewrites without any luck)

For reference, in nginx my images were in:
https://website.com/paperclip/pictures/images/000/000/001/original/image.jpg

Thanks!

(Matthew Fay) #2

Hi @Diego_Suarez, welcome to the Caddy community!

If you’ve symlinked the directory, I’d guess that you don’t need any rewrites. If webroot+path resolves to a file on your filesystem, Caddy should serve it.

One other option is to use a path scoped site definition.

example.com/paperclip/ {
  root /mnt/volume/paperclip/
  # Copy other relevant configuration here also
}