Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix problem with proxy config for image proxy #9

Conversation

josecelano
Copy link
Member

We need to pass the original URL encoded URL:

http://index.torrust-demo.com/api/v1/proxy/image/https%3A%2F%2Fraw.githubusercontent.com%2Ftorrust%2Ftorrust-index%2Fdevelop%2Fdocs%2Fmedia%2Ftorrust_logo.png

from the Nginx reverse proxy to the Index API image proxy.

Otherwise we get a 404. The proxy was passing an URL like this:

"/v1/proxy/image/https:/raw.githubusercontent.com/torrust/torrust-index/develop/docs/media/torrust_logo.png

which is not valid because it containts unscaped chars.

Not It's passing:

"/v1/proxy/image/https%3A%2F%2Fraw.githubusercontent.com%2Ftorrust%2Ftorrust-index%2Fdevelop%2Fdocs%2Fmedia%2Ftorrust_logo.png"

This solution is not passing the rest of the URL: query parameters. But we do not need them in the image proxy.

We need to pass the original URL encoded URL:

http://index.torrust-demo.com/api/v1/proxy/image/https%3A%2F%2Fraw.githubusercontent.com%2Ftorrust%2Ftorrust-index%2Fdevelop%2Fdocs%2Fmedia%2Ftorrust_logo.png

from the Nginx reverse proxy to the Index API image proxy.

Otherwise we get a 404. The proxy was passing an URL like this:

"/v1/proxy/image/https:/raw.githubusercontent.com/torrust/torrust-index/develop/docs/media/torrust_logo.png

which is not valid because it containts unscaped chars.

Not It's passing:

"/v1/proxy/image/https%3A%2F%2Fraw.githubusercontent.com%2Ftorrust%2Ftorrust-index%2Fdevelop%2Fdocs%2Fmedia%2Ftorrust_logo.png"

This solution is not passing the rest of the URL: query parameters. But
we do not need them in the image proxy.
@josecelano josecelano force-pushed the 6-nginx-configuration-for-the-image-proxy-is-not-working branch from fce37ae to 3070c88 Compare February 5, 2024 16:26
@josecelano josecelano linked an issue Feb 5, 2024 that may be closed by this pull request
@josecelano josecelano self-assigned this Feb 5, 2024
@josecelano josecelano added the bug Something isn't working label Feb 5, 2024
@josecelano josecelano merged commit cee230f into torrust:main Feb 5, 2024
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Nginx configuration for the image proxy is not working
1 participant