TandoorRecipes / recipes

Application for managing recipes, planning meals, building shopping lists and much much more!
https://docs.tandoor.dev
Other
5.13k stars 547 forks source link

tandoor web not showing pictures of recipees #2231

Closed Neon-44 closed 6 months ago

Neon-44 commented 1 year ago

Tandoor Version

latest vabene1111/recipees docker container

Setup

Docker / Docker-Compose

Reverse Proxy

Caddy

Other

No response

Bug description

the image is shown while importing, but when i look at the recipe after it was imported, it doesn't show anything

my caddyfile:

tandoor.local.[domain].[tld] {
   header Host $http_host
   header X-Forwarded-Proto $scheme;

   reverse_proxy tandoor-web:8080
}

i tried with setting the MEDIA_URL to tandoor.local.[domain].[tld]/media:8080 as i saw in another issue, but that didn't help either.

i searched the Github Issues, the Website, any Forums i could find, but i just can't fix it.

Relevant logs

No response

vabene1111 commented 1 year ago

please see https://docs.tandoor.dev/faq/#why-are-images-not-loading

otherwise look at where tandoor is making the request to and why this is not the place you are serving.

Neon-44 commented 1 year ago

nope, sadly not the solution. i've tried it with either header Host $http_host or header X-Forwarded-Proto $scheme as well as with both activated at the same time, as described in the CSRF Error section and i have the tandoor-nginx container actiivated.

both common issues described in this FAQ sadly do not apply to me.

i get an 404 error (in the browser as well as in docker logs), despite making sure (via docker exec) that the files actually exist inside the nginx container

maybe nginx can't access the Files inside the container?

i have taken the docker-compose and .env file from the website, was there anything i forgot to modify?

chall4478 commented 1 year ago

I had similar issue. I was able to resolve it by changing my reverse proxy to connect to port 80 of the nginx-recipes service and not port 8080 of the web-recipes service

smilerz commented 1 year ago

nope, sadly not the solution. i've tried it with either header Host $http_host or header X-Forwarded-Proto $scheme as well as with both activated at the same time, as described in the CSRF Error section and i have the tandoor-nginx container actiivated.

both common issues described in this FAQ sadly do not apply to me.

i get an 404 error (in the browser as well as in docker logs), despite making sure (via docker exec) that the files actually exist inside the nginx container

maybe nginx can't access the Files inside the container?

i have taken the docker-compose and .env file from the website, was there anything i forgot to modify?

What is serving the media files? Gunicorn or another web server?

Neon-44 commented 1 year ago

@chall4478 solved the issue for me, thank you very much, i really appreciate it 😄

@smilerz and @vabene1111, i see you're collaborators. i have a principle that every time someone helps me solve something, i contribute documentation on it to help others and the developers, so if you are okay with it, i would write documentation on this so you can then add it to your FAQ or append it to your docker.md or place it wherever you like :)

okay, future Neon-44 here, i just went and looked at what i could contribute and found the Problem here.

i wanted to go and close the ports on the tandoor-web container and open them on the tandoor-nginx container, to make it clear that was the container you should use, when i saw that you already did that on the github.

in the Codeblock on docs.tandoor.dev (https://docs.tandoor.dev/install/docker/) however, it seems it was forgotten to change this.

i know i am technically at fault for not adhering to best practice when getting the compose.yml (and i switched them out now), but i would personally still recomment to either:

(not to sound entitled, i am absolutely grateful for what you do and love you, and if i wasn't a student I'd even sponsor you. but since i don't have money i can only contribute documentation sadly (unless you want my abhorrent python code that is))

anyways, i'll leave it open since the issue now seems to be the Codeblock on the website, but feel free to close at your own accord 😃 oh, and if you want me to write documentation on this (or possibly anything else, maybe adding a caddy reverse proxy config), feel free to reach out to me 😃

danikuci1 commented 7 months ago

im having a similar issue thats unresolved by the FAQ:

tandoor is running using the plain docker compose file, and is behind a caddy reverse proxy. this docker compose seems to have latest fix that @Neon-44 mentioned above. everything so far works great expect pictures. The web gui generates a success message when I upload one, and they preview OK when scraping from a webpage, just don't display on the final recipe.

interestingly, when loading a recipe, the nginx logs seem to imply the file is being fetched, and its there on the hard drive, but somehow....nothing.

"GET /mediafiles/recipes/0b01a1c6-0554-4afd-9c7e-8a7fed6aa904_1.jpg HTTP/1.1" 404 21968 "https://recipes.domain/search/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:120.0) Gecko/20100101 Firefox/120.0"

 ls mediafiles/recipes/0b01a1c6-0554-4afd-9c7e-8a7fed6aa904_1.jpg
mediafiles/recipes/0b01a1c6-0554-4afd-9c7e-8a7fed6aa904_1.jpg
smilerz commented 7 months ago

/mediafiles/recipes/

That's not a valid url with the default configuration. Did you change the media_url in the env?