Getting error trying to access localhost

1. The problem I’m having:

Is there something I need to put into my caddyfile to allow http://localhost to work in my Browser?

2. Error messages and/or full log output:

I can access my domain name fine but when I try localhost in Firefox I get the below error;

Secure Connection Failed

An error occurred during a connection to 127.0.0.1. 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.
PASTE OVER THIS, BETWEEN THE ``` LINES.
Please use the preview pane to ensure it looks nice.

3. Caddy version:

I am running Caddy for Windows, not sure how to tell the version number but I updated it yesterday.

4. How I installed and ran Caddy:

I run Caddy off my C: drive with a caddyfile

a. System environment:

I am running it on Windows server 2019 64bit

b. Command:

PASTE OVER THIS, BETWEEN THE ``` LINES.
Please use the preview pane to ensure it looks nice.

c. Service/unit/compose file:

PASTE OVER THIS, BETWEEN THE ``` LINES.
Please use the preview pane to ensure it looks nice.

d. My complete Caddy config:

PASTE OVER THIS, BETWEEN THE ``` LINES.
Please use the preview pane to ensure it looks nice.

5. Links to relevant resources:

The content of your Caddyfile would be helpful. Since you haven’t posted it, I’m just going to guess here.

I’m guessing your current config looks like this:

{
  # some general section stuff
}

your-domain-name {
  # your domain stuff
}

When you try to connect to localhost, your browser hits the your-domain-name site, which makes your browser complain about SSL_ERROR_INTERNAL_ERROR_ALERT, which is an “invalid SSL certificate” error. Which is understandable, since your-domain-name certificate doesn’t cover the localhost name.

Try to add the following into your Caddyfile:

localhost {
	respond "Hello, world!"
}

Replace respond "Hello, world!" with whatever you need to show on your localhost.

1 Like

Ok, thanks for the solution. Working now :slight_smile:

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