inventree / InvenTree

Open Source Inventory Management System
https://docs.inventree.org
MIT License
4.39k stars 792 forks source link

Parts Images don't show up #8567

Open Ktzenjammer opened 6 days ago

Ktzenjammer commented 6 days ago

Deployment Method

Describe the problem*

Hello there, hope you can help me...

Well, i think a screen capture will speak for itself :

Image

Steps to Reproduce

I made a fresh install of inventree on my synology Nas via Docker Container Manager.

Image

Relevant log output

matmair commented 6 days ago

We need the full server information and logs to help with anything.

SchrodingersGat commented 6 days ago

The /media/ files are not being served correctly. If you have followed the docker setup guide, then your inventree-proxy container should be serving these files.

Additionally:

Ktzenjammer commented 4 days ago

I just checked my installation and it doesn't use the caddy proxy server because i'm on a Synology Nas and i want to use the native reverse proxy of the nas to access inventree. I tried to reinstall inventree with the proxy but i can't connect trought the nas reverse proxy (i get the "ERR_TOO_MANY_REDIRECTS" error)

According to this page : https://docs.inventree.org/en/stable/start/serving_files/ I tried to set the debug mode to True and when i started it again, my images just show up (that could be a solution, i don't know if it's safe to stay in debug mode)

So i discovered my real problem is that i don't know how to configure my caddy proxy correctly on a Synology Nas :/

matmair commented 4 days ago

I do not think we can guide you if you are not using the full stack; using multiple reverse proxies is introducing complexity.

An instance running in debug mode is leaking a lot of info and not enforcing many security measures (I suspect that those might be causing the issues in the redirection). If access to the host interface is only available to trusted environments and users it might be ok to run the server in debug mode. I have to stress that this is not the intended setup and the server is leaking a lot of info to unauthorised and less-privileged users; there are also performance penalties in various areas of up to 30% in CPU and RAM usage.

You could try the Server Access controls https://docs.inventree.org/en/stable/start/config/#server-access - especially INVENTREE_TRUSTED_ORIGINS and INVENTREE_COOKIE_SAMESITE

RedEchidnaUK commented 3 days ago

I recently started to look at Inventree again for home/personal use with the plan to run it on my Synology NAS and found the same thing. As mentioned above it will be to do with the Iventree reverse proxy and the Synology reverse proxy not working well together. I came up with a few potential ways to work around this,

  1. Use the Synology proxy to replace the Inventree proxy (which I think you are trying to do)
  2. Don't use the Synology proxy and expose the Inventree proxy on non-standard ports
  3. Use a proxy in front of the Inventree proxy, but not the Synology proxy

Option 1. This might be possible to get working, but you will have to figure out how the Synology proxy works internally on DSM and likely modify the config via the command line. I think it uses Nginx, so the config might be straight forward as Inventree provide a Nginx example in their compose file. However, as you are modifying these files outside of the GUI there is a good chance they won't work after a reboot or DSM upgrade (found this out trying to bodge something else on DSM). For this reason, I discounted option 1.

Option 2. Probably the easiest option, but you're likely wanting to use a reverse proxy so you don't have to manage certificates and you don't have to remember port numbers on the end of your URL. Which is why I discounted this option.

Option 3. The most convoluted setup but was what I ended up using. The downside is putting a proxy in-front of another proxy may causes issues, as you have found out with the Synology proxy. The good news is if you have full control of the proxy, you can most likely fix the issue and you are not tied to Synology if you want to move your containers at a later date.

As a rough outline, this is what I have done.

I used Nginx as I had odd things happen with Caddy, but I'm less familiar with it so that might have been me messing things up as I was trying various solutions. I also didn't expose the Inventree reverse-proxy container ports as there is no need since the new proxy can access it internally via Docker using the created 'reverse proxy' network. In NPM I didn't have to do anything special to get Inventree to work, as it seemed to pass the required information to the Inventree proxy out of the box.

I'm happy to go over this solution in more detail, including my full config files and how I'm also using Portainer to manage my config/deployments on Synology. However, I feel it might be best to move the conversation over to the 'Discussions' area so the developers can close this issue since it isn't really an issue with Inventree.

Lastly, for anyone reading this, please please be aware what I have done above is NOT supported by the Inventree team so you may have to fix any future issues with running double proxies and compose modifications etc. yourself.