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

401 Unauthorized /api/v1/collections/statistics when try to expose web interface from local network to internet #9

Closed
fightingyuman opened this issue Dec 27, 2021 · 4 comments · Fixed by #10

Comments

@fightingyuman
Copy link

fightingyuman commented Dec 27, 2021

Describe the bug:
I use nginx to proxy attu web interface in an internal network environment to internet, I get this error when click "Connect".

Steps to reproduce:

  1. My host IP is 192.168.171.232, with milvus port 19530, insight port 3000. My docker started with HOST_URL=https://attu.mydomain.com:13679 and MILVUS_URL=192.168.171.232:19530
  2. I installed nginx proxy for this host, expose port 13679 and use host name attu.mydomain.com with ssl on, and proxy it to 192.168.171.232:3000. here is my nginx conf:
server {
   listen       13679 ssl;
   server_name  attu.mydomain.com;
   root         /usr/share/nginx/html;
   ssl_certificate "/ssl/server.crt";
   ssl_certificate_key "/ssl/server.key";
   ssl_session_cache shared:SSL:1m;
   ssl_session_timeout  10m;
   ssl_ciphers ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP;
   ssl_prefer_server_ciphers on;
   location / {
           proxy_pass http://192.168.171.232:3000/;
           proxy_redirect default;
           add_header 'Access-Control-Allow-Origin' '*'; 
   }
}
  1. I can access the website https://attu.mydomain.com:13679 on internet and connect milvus returns 200, but after connected, when access /api/v1/collections/statistics, it returns 401 Unauthorized. The attu server logs is here:
POST 200 /api/v1/milvus/connect 106.541 ms @ Mon, 27 Dec 2021 09:54:01 GMT ::ffff:192.168.171.232 from undefined Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.110 Safari/537.36 

GET /api/v1/collections/statistics 401 UnauthorizedError: Please connect milvus first

GET 401 /api/v1/collections/statistics 3.464 ms @ Mon, 27 Dec 2021 09:54:01 GMT ::ffff:192.168.171.232 from undefined Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.110 Safari/537.36

The web browser POST to https://attu.mydomain.com:13679/api/v1/milvus/connect post data is:

{"address":"192.168.171.232:19530"}

and the server returns data is:

{"data":{"address":"192.168.171.232:19530"},"statusCode":200}

Fine way:
I can access it when in the local internet. change HOST_URL to http://192.168.171.232:3000, then everything is fine.

Attu version:
zilliz/attu:latest

Milvus version:
milvusdb/milvus:v2.0.0-rc8-20211104-d1f4106

@fightingyuman fightingyuman changed the title 401 Unauthorized when /api/v1/collections/statistics 401 Unauthorized /api/v1/collections/statistics when try to expose web interface from local network to internet Dec 27, 2021
@nameczz
Copy link
Collaborator

nameczz commented Dec 27, 2021

We fixed 401 error and update docker 6 days ago. May be your zilliz/attu is not the newest.

Please try to remove your zilliz/attu local and pull it again.

@fightingyuman
Copy link
Author

fightingyuman commented Dec 28, 2021

We fixed 401 error and update docker 6 days ago. May be your zilliz/attu is not the newest.

Please try to remove your zilliz/attu local and pull it again.

It's the newest version. here is my RepoDigests, it match digest on docker hub:

[root@localhost home]# docker inspect zilliz/attu:latest 
[
    {
        "Id": "sha256:b5d0c4ba815dc1c34ef9cbb1d747093b63b6ce0c56f31962643e567222e46516",
        "RepoTags": [
            "zilliz/attu:latest"
        ],
        "RepoDigests": [
            "zilliz/attu@sha256:489ef0eb4e72762f6021ab7d1cfe92a597bbde4e85e9d0ebfbd3c97b73a89039"
        ],

When I use the IP address 192.168.171.232, It's good.
But when I use nginx proxy, and set Host url to the domain url, it expose 401 Error.

@nameczz
Copy link
Collaborator

nameczz commented Jan 4, 2022

@fightingyuman We set milvus_address header when call attu server.
If use nginx to proxy server, nginx will ignore underscores headers.
Already fix it , will release it. today, please try it again.
Thanks you and sorry for reply delay :)

@fightingyuman
Copy link
Author

@fightingyuman We set milvus_address header when call attu server. If use nginx to proxy server, nginx will ignore underscores headers. Already fix it , will release it. today, please try it again. Thanks you and sorry for reply delay :)

I updated to the newest, it's fixed, 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 a pull request may close this issue.

2 participants