[stunnel-users] How to pass URL parameters in connect to

Christopher Schultz chris at christopherschultz.net
Fri Feb 14 16:38:51 CET 2020


Shashank,

On 2/13/20 20:33, Shashank Shekhar wrote:
> Hi,
> 
> I am evaluating stunnel for a project. I want to translate a HTTP call 
> to HTTPS. When I specify the URL to send to in the config file, I get 
> error ""Unknown TCP service "443/api/path""". My config is as below:
> 
> [https]
> client = yes
> accept  = 4433
> connect = myurl.com:443/api/path <http://myurl.com:443/api/path>

This is not proper syntax. stunnel only routes connections to host:port; 
it's not an HTTP proxy. So you want this:

connect = myurl.com:443

> When I try the same thing without the sub-paths "/api/path" the 
> connection works, but of course it doesn't hit the URL I want to hit.

Your client needs to specify the /api/path in the URL it's trying to access.

> How do I achieve this? I tried going through the documentation, but 
> couldn't figure it out.

If you want to map e.g. http://localhost:4433/ -> 
https://myurl.com:443/api/path then you will need something more 
complicated than stunnel.

One way to do this is with a reverse-proxy on the "myurl" server-side: 
accept URLs with / and redirect them to /api/path.

But the best thing to do is probably change the client so that it is 
requesting /api/path and not /

-chris


More information about the stunnel-users mailing list