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

Fixed When the MINIO_BROWSER_REDIRECT_URL parameter contains path, the console cannot be accessed normally. #2725

Closed
wants to merge 1 commit into from

Conversation

polaris-phecda
Copy link

@polaris-phecda polaris-phecda commented Mar 20, 2023

What does this do?

When the MINIO_BROWSER_REDIRECT_URL parameter contains path, like http://0.0.0.0:9001/minio-console, the homepage cannot be accessed.

How does it look?

526FFE3B-5670-4A4D-9FC4-4A29899B97B4

How to test this PR?

1、Run the following command in the portal-ui directory:

yarn install
yarn run build

2、According to the PR, modify three lines of code in the minio.
minio/minio#17259

Use the local console project in the go.mod file of the minio.

replace github.com/minio/console v0.27.0 => ../console

Build minio.

go build -o minio.exe main.go

3、Configure the MINIO_BROWSER_REDIRECT_URL env, like MINIO_BROWSER_REDIRECT_URL=http://localhost:9001/minio-console, and then run the minio server(The example is in Windows.).

set MINIO_BROWSER_REDIRECT_URL=http://localhost:9001/minio-console

./minio.exe server --console-address localhost:9001 D:\6-program\minio\data

4、Access the minio console through http://localhost:9001/minio-console/ in browser
526FFE3B-5670-4A4D-9FC4-4A29899B97B4

5、If Nginx is used, you need to configure /subpath/ and /subpath/ws/.

...
location /minio-console {
    proxy_set_header Host $host;
    proxy_set_header Remote-Addr $remote_addr;
    proxy_pass http://127.0.0.1:9001;
    client_max_body_size 0;
}

location /minio-console/ws {
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "upgrade";
    proxy_set_header Host $host;
    proxy_read_timeout   3600s;
    proxy_set_header Remote-Addr $remote_addr;
    proxy_pass http://127.0.0.1:9001;
}
...

Relates to: #2774

@polaris-phecda
Copy link
Author

@dvaldivia @bexsoft hello brother, I have been running the code associated with the PR locally and promoted it within our team for a while. Please review whether the code can be merged into your branch.

@mskyttner
Copy link

Reverse proxying the console to a subpath of the same domain where the minio server is running is much needed, +1 for this.

@mskyttner mskyttner mentioned this pull request Apr 25, 2023
Copy link
Collaborator

@cesnietor cesnietor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for sending this change, I've added some comments to it.

restapi/embedded_spec.go Outdated Show resolved Hide resolved
restapi/embedded_spec.go Outdated Show resolved Hide resolved
@cesnietor
Copy link
Collaborator

Issue #2774 has been assigned and will be addressed there.

@polaris-phecda polaris-phecda requested a review from cesnietor May 6, 2023 03:03
portal-ui/src/api/consoleApi.ts Outdated Show resolved Hide resolved
@polaris-phecda polaris-phecda requested a review from dvaldivia May 13, 2023 03:00
restapi/operations/console_api.go Outdated Show resolved Hide resolved
@dvaldivia
Copy link
Collaborator

the way we regenerate the auto-generated files from the swagger specification is via the make swagger-gen command, which if you run, it removes all the code you added on restapi/operations/console_api.go and restapi/operations/console_api_test.go

@dvaldivia
Copy link
Collaborator

I'm not able to test this PR successfully, do you mind sharing your nginx.conf ?

mine is simply

events { worker_connections 1024; }

http {

server {
    listen 8000;

    location /console/subpath/ {
        rewrite   ^/console/subpath/(.*) /$1 break;
        proxy_pass http://localhost:9091;
    }
}

}

but I don't see the assets successfully getting served

@polaris-phecda
Copy link
Author

polaris-phecda commented May 19, 2023

I'm not able to test this PR successfully, do you mind sharing your nginx.conf ?

mine is simply

events { worker_connections 1024; }

http {

server {
    listen 8000;

    location /console/subpath/ {
        rewrite   ^/console/subpath/(.*) /$1 break;
        proxy_pass http://localhost:9091;
    }
}

}

but I don't see the assets successfully getting served

Did you forget that Connection "upgrade" needs to be added to the websocket API? This is my config file.

...

    location /minio-console {
        proxy_set_header Host $host;
        proxy_set_header Remote-Addr $remote_addr;
        proxy_pass http://127.0.0.1:9001;
        client_max_body_size 0;
    }

    location /minio-console/ws {
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
        proxy_set_header Host $host;
        proxy_read_timeout   3600s;
        proxy_set_header Remote-Addr $remote_addr;
        proxy_pass http://127.0.0.1:9001;
    }

...

it works fine.

@polaris-phecda polaris-phecda requested a review from dvaldivia May 22, 2023 02:28
@polaris-phecda polaris-phecda force-pushed the master branch 2 times, most recently from 89ec1af to d41ffa1 Compare May 22, 2023 08:09
@polaris-phecda
Copy link
Author

polaris-phecda commented May 22, 2023

I'm not able to test this PR successfully, do you mind sharing your nginx.conf ?

mine is simply

events { worker_connections 1024; }

http {

server {
    listen 8000;

    location /console/subpath/ {
        rewrite   ^/console/subpath/(.*) /$1 break;
        proxy_pass http://localhost:9091;
    }
}

}

but I don't see the assets successfully getting served

If you start the console through minio server instead of directly starting the console, you also need to inject basepath into minio server according to this submission.
minio/minio#17259

@cesnietor
Copy link
Collaborator

This should have been solved here #2818, please reopen if this is not the case. Thanks.

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

Successfully merging this pull request may close these issues.

4 participants