karlomikus / bar-assistant

Bar assistant is a all-in-one solution for managing your home bar
https://barassistant.app
MIT License
526 stars 22 forks source link

Recipe images not retrieved #312

Closed dlmw closed 1 month ago

dlmw commented 1 month ago

Describe the bug I have just created my Bar Assistant instance. Everything works fine but the images don't appear. However, thumbnails work fine.

After inspecting the HTML, I see that the URI of the picture is "https://bar.mydomain.com/uploads/cocktails/1/1934-cosmo-1_79lTcl.jpg", but it should be "https://bar.dlmw.ch/**bar**/uploads/cocktails/1/1934-cosmo-1_79lTcl.jpg". My reverse proxy is Caddy and the Caddyfile looks somewhat like this:

bar.mydomain.com {
    handle_path /search/* {
        reverse_proxy meilisearch:7700
    }
    handle_path /bar/* {
        reverse_proxy barassistant:3000
    }
    handle_path /* {
        reverse_proxy saltrim:8080
    }
}

To Reproduce

  1. Create a Caddyfile containing the snippet above

Versions:

dlmw commented 1 month ago

I managed to solve it by modifying the Caddyfile like so:

bar.dlmw.ch {
        # here
    @uploads {
        path_regexp uploads ^/uploads/(.*)
    }
    rewrite @uploads /bar/uploads/{re.uploads.1}

    handle_path /search/* {
        reverse_proxy meilisearch:7700
    }
    handle_path /bar/* {
        reverse_proxy barassistant:3000
    }
    handle_path /* {
        reverse_proxy saltrim:8080
    }
}

Maybe the thumbnails should be served at the same subpath than the images.