Score:1

ngx_http_proxy_connect_module with user and password

jp flag

I am using Nginx with ngx_http_proxy_connect_module, and I want to know if it possible to use with user and password, something like this

curl -vvv "ifconfig.me" -x user:password@localhost:8000

Here my nginx.conf

worker_processes auto;

daemon off;

events { }

http {
    server_names_hash_bucket_size 128;

    server {
        listen 8000;

        resolver 1.1.1.1;

        proxy_connect;
        proxy_connect_allow all;
        proxy_connect_connect_timeout 10s;
        proxy_connect_read_timeout 10s;
        proxy_connect_send_timeout 10s;

        auth_basic "Restricted Content";
        auth_basic_user_file /etc/nginx/.htpasswd;

        location / {
            proxy_pass http://$http_host;
            proxy_set_header Host $http_host;
        }
    }
}

Testing, no luck:

curl -vvv "ifconfig.me" -x user:password@localhost:8000

*   Trying 127.0.0.1:8000...* TCP_NODELAY set
* Connected to localhost (127.0.0.1) port 8000 (#0)
* Proxy auth using Basic with user 'user'
> GET http://ifconfig.me/ HTTP/1.1
> Host: ifconfig.me
> Proxy-Authorization: Basic dXNlcjpwYXNzd29yZA==
> User-Agent: curl/7.68.0
> Accept: */*
> Proxy-Connection: Keep-Alive
> 
* Mark bundle as not supporting multiuse
< HTTP/1.1 401 Unauthorized
< Server: nginx/1.21.3
< Date: Sat, 30 Oct 2021 18:07:44 GMT
< Content-Type: text/html
< Content-Length: 179
< Connection: keep-alive
* Authentication problem. Ignoring this.
< WWW-Authenticate: Basic realm="Restricted Content"
< 
<html>
<head><title>401 Authorization Required</title></head>
<body>
<center><h1>401 Authorization Required</h1></center>
<hr><center>nginx/1.21.3</center>
</body>
</html>
* Connection #0 to host localhost left intact
*
Score:0
jp flag

I ended using Squid as a proxy

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.