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

Share URL Returns 403 #3331

Closed
nreisingercres opened this issue May 6, 2024 · 9 comments · Fixed by #3334
Closed

Share URL Returns 403 #3331

nreisingercres opened this issue May 6, 2024 · 9 comments · Fixed by #3334
Assignees

Comments

@nreisingercres
Copy link
Contributor

NOTE

If this case is urgent, please subscribe to Subnet so that our 24/7 support team may help you faster.

Using the share URL returns a 403

Expected Behavior

The file should download

Current Behavior

The server returns a 403 status code

Possible Solution

Use MINIO_BROWSER_REDIRECT_URL to generate the url

Steps to Reproduce (for bugs)

  1. Configure minio to go through a proxy with the console sub path path i.e minio.com/minio/console
  2. Create a share url
  3. Try to go to the share url
  4. note the error
  5. add the sub path i.e. /minio/console
  6. Note it works

Context

Trying to use curl to download a file

Regression

Your Environment

  • MinIO version used (minio --version): RELEASE.2024-05-01T01-11-10Z
  • Server setup and configuration:
  • Operating System and version (uname -a):
@prakashsvmx
Copy link
Member

MINIO_BROWSER_REDIRECT_URL is not for share url. May be you are looking for MINIO_SERVER_URL

@nreisingercres
Copy link
Contributor Author

If so that would be very confusing as to why my work around works.

I have MINIO_SERVER_URL set to the minio server without the sub path for the console.
(the redacted part is the same on both)

MINIO_SERVER_URL: https://minio.<redacted>.com/
MINIO_BROWSER_REDIRECT_URL: https://minio.<redacted>.com/minio/console/

When I take the share url and manually add /minio/console/ it works. It appears that the API api/v1/download-shared-object is on the console not the main minio server.

@prakashsvmx
Copy link
Member

#3284 when I checked the Sub path also worked fine.

@cesnietor cesnietor self-assigned this May 6, 2024
@nreisingercres
Copy link
Contributor Author

#3284 when I checked the Sub path also worked fine.

Interesting, do I possibly have something misconfigured?

I also dug through the code some and found this section. If I'm reading it right, it uses the scheme and the host of the request to generate the url. I don't see it taking into account the path.
https://github.com/minio/console/blob/master/api/user_objects.go#L1104-L1116

@cesnietor
Copy link
Collaborator

@nreisingercres Try not defining the trailing slash on the minio_server_url:
e.g.

MINIO_BROWSER_REDIRECT_URL=http://localhost:8000/console/subpath/ 
MINIO_SERVER_URL=http://localhost:9000

@nreisingercres
Copy link
Contributor Author

@nreisingercres Try not defining the trailing slash on the minio_server_url: e.g.

MINIO_BROWSER_REDIRECT_URL=http://localhost:8000/console/subpath/ 
MINIO_SERVER_URL=http://localhost:9000

Same issue when removing the trailing slash on MINIO_SERVER_URL

It still generates
https://minio.<redacted>.com/api/v1/download-shared-object/ and returns 403 but when I change it to https://minio.<redacted>.com/minio/console/api/v1/download-shared-object/ it works

@cesnietor
Copy link
Collaborator

thanks, I'll take a look. I also remember testing with subpath and nginx and worked fine. But will try to reproduce.

@nreisingercres
Copy link
Contributor Author

thanks, I'll take a look. I also remember testing with subpath and nginx and worked fine. But will try to reproduce.

Thanks, I'm 90% sure the issue is here as getRequestURLWithScheme() uses only r.tls and r.host nothing about the path: https://github.com/minio/console/blob/master/api/user_objects.go#L1104-L1116
I would try to fix it, but I'm unsure how to begin going about getting the sub path

@cesnietor
Copy link
Collaborator

cesnietor commented May 6, 2024

I was able to reproduce it, we need to pass the MINIO_BROWSER_REDIRECT_URL from minio to Console cause right now we only pass the subpath here.
And then add it in https://github.com/minio/console/blob/master/api/user_objects.go#L1109

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants