Reverse proxy to https with own certificates

I want to have “timeout gateway” in front of everything. binded to port 80/443

I want it forwards all requests to second gateway, which manages list of websites/domains and manages tls certificates.
also timeout gateway should redirect all http trafic to https.

Later on I want to configure timeout logic to this first getaway, so it will retry all requests to second gateway.

That way I don’t need to setup this timeout logic for each specific host.

Don’t know how to configure this ins caddy. It gives me ssl certificate error in browser

1. Caddy version (caddy version):

v2.0.0 h1:pQSaIJGFluFvu8KDGDODV8u4/QRED/OPyIR+MWYYse8=

2. How I run Caddy:

caddy run

with Caddyfile

a. System environment:

Raspberian/Debian

b. Command:

caddy run

d. My complete Caddyfile or JSON config:

:443

reverse_proxy 127.0.0.1:9001

3. The problem I’m having:

In browser:

Secure Connection Failed

An error occurred during a connection to www.artem.ee. Peer reports it experienced an internal error.

Error code: SSL_ERROR_INTERNAL_ERROR_ALERT

    The page you are trying to view cannot be shown because the authenticity of the received data could not be verified.
    Please contact the website owners to inform them of this problem.

4. Error messages and/or full log output:

2020/06/05 14:52:19 http: TLS handshake error from 192.168.8.100:54985: no certificate available for 'real.domain.com'

5. What I already tried:

tried all options related to tls, but that does not work. tried to remove https: prefix. nothing works

Hi @artem-korolev, welcome to the Caddy community.

Looking at your Caddyfile above, you’ve used the site address :443.

Because you haven’t told Caddy what your domain name is, it can’t fetch a certificate for it. No fetched certificate → no cert on hand to serve HTTPS clients when they indicate your domain name. No cert to serve → TLS error shown in browser.

To serve HTTPS for your site, you will need to add your domain name to your Caddyfile, or configure On-Demand TLS.

Some further reading:
Caddyfile Concepts — Caddy Documentation
Automatic HTTPS — Caddy Documentation

This topic was automatically closed after 30 days. New replies are no longer allowed.