upgrade http:// to https:// when using Hitch

76 views Asked by At

I'm trying to use Hitch to add https support for one old project with own http server written in C. The Hitch itself is working, but is there any way how to handle, when user try to use http?

E.g. I have the hitch on port 8443.
If I use https:\\1.2.3.4:8443 it works.
But when I write http:\\1.2.3.4:8443 (or just 1.2.3.4:8443) browser doesn't connect.

I know that Hitch is just "dumb" proxy and it doesn't resolve protocols. So is there any way how to achieve this? Or maybe another proxy with similar functionality? I tried also stunnel, but it's the same. I'm using Debian 10.

1

There are 1 answers

0
Thijs Feryn On

Hitch is developed as an independent TLS proxy. However, the primary use case remains TLS termination for Varnish Cache.

If you're looking to proxying both TLS & non-TLS encrypted HTTP traffic, why not use Varnish as your main proxy? While it is specialized in HTTP caching, you're not forced to use the caching part.

You could route all your traffic to Varnish and install Hitch in front of Varnish to tackle the TLS part. You can set the X-Forwarded-Proto header to the right value to make your web server understand whether incoming traffic was originally made via HTTP or HTTPS.

See https://www.varnish-software.com/developers/tutorials/terminate-tls-varnish-hitch/ for a tutorial I made on using Hitch to terminate TLS with Varnish.

If you're looking for a Varnish install guide, go have a look at https://www.varnish-software.com/developers/tutorials/#installations

For Varnish documentation, please see https://varnish-cache.org/docs/index.html