Hi Peter,

Thank you for bringing up the curl version concern. Last night, I attempted to connect using proxies directly with Python code on Ubuntu 16 (not using curl), but encountered the same issue.

Today, upon seeing your reply, I revisited the Python code and found the issue: there was a typo in the proxy URL 😅. Instead of https://address:8443, I mistakenly used http://address:8443.

Thank you so much for your help in getting this sorted out. I truly appreciate it!


On Sat, Jun 29, 2024 at 4:11 AM Peter Pentchev <roam@ringlet.net> wrote:
On Fri, Jun 28, 2024 at 12:19:51PM -0000, jensen@fixes.hk wrote:
> Hi Peter,
>
> Thanks for your response. The purpose of the stunnel config is to have
> my connection encrypted using ssl while connecting to tinyproxy. 
>
> we have 1 server in HK that needs to connect to OpenAI API (HK region
> will not get support anymore on 9 July 2024). so I think to setup new
> server in supported region as proxy server, use tinyproxy for proxy
> server and make sure the connection is secure by using stunnel. so
> this way our HK server can still call OpenAI API by using the new
> proxy server (stunnel + tinyproxy).
>
>
> on above err log, I use this curl command to connect to the proxy server 
> curl --proxy "https://address:8443" https://www.google.com -v
>
> the command above is working fine on my other server except Ubuntu16.04.

OK, now I understand what you're trying to do, and I think I know what
the problem is. The support for HTTPS proxies in cURL was only added in
version 7.52, while Ubuntu 16.04 only has cURL 7.47. So if you're
running cURL from the same host that runs stunnel, Ubuntu 16.04's cURL
will not send the correct request. Try running cURL from another host, or
testing with `openssl s_client -connect address:8443` and then typing in
an HTTP CONNECT request by hand.

Hope that helps!

G'luck,
Peter

--
Peter Pentchev  roam@ringlet.net roam@debian.org peter@morpheusly.com
PGP key:        https://www.ringlet.net/roam/roam.key.asc
Key fingerprint 2EE7 A7A5 17FC 124C F115  C354 651E EFB0 2527 DF13