1. Caddy version (caddy version
):
v2.4.3 h1:Y1FaV2N4WO3rBqxSYA8UZsZTQdN+PwcoOcAiZTM8C0I=
2. How I run Caddy:
caddy reverse-proxy --from :80 --to :3001
a. System environment:
Windows 10, no Docker. Installed with chocolatey
b. Command:
caddy reverse-proxy --from :80 --to :3001
c. Service/unit/compose file:
Not using docker or other tools.
d. My complete Caddyfile or JSON config:
I am running it without a Caddyfile
3. The problem I’m having:
I have set up a Dynamic DNS with Namecheap’s DDNS Client(v2). Everything works fine when I try to access this app with the port but when I try to open the webpage directly on port 80
, with the command running, I just can’t get it to work.
4. Error messages and/or full log output:
Error in the browser:
The character encoding of the plain text document was not declared. The document will render with garbled text in some browser configurations if the document contains characters from outside the US-ASCII range. The character encoding of the file needs to be declared in the transfer protocol or file needs to use a byte order mark as an encoding signature.
Error in the terminal:
2021/06/20 21:19:57.896 ERROR http.log.error EOF {"request": {"remote_addr": "127.0.0.1:49279", "proto": "HTTP/1.1", "method": "GET", "host": "localhost", "uri": "/", "headers": {"Accept": ["text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8"], "Upgrade-Insecure-Requests": ["1"], "Sec-Fetch-Mode": ["navigate"], "Sec-Fetch-Site": ["none"], "Sec-Fetch-User": ["?1"], "User-Agent": ["Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:90.0) Gecko/20100101 Firefox/90.0"], "Accept-Language": ["en-US,en;q=0.5"], "Accept-Encoding": ["gzip, deflate"], "Connection": ["keep-alive"], "Sec-Fetch-Dest": ["document"], "Cache-Control": ["max-age=0"]}}, "duration": 0.0009988, "status": 502, "err_id": "gsgy163sq", "err_trace": "reverseproxy.statusError (reverseproxy.go:857)"}
5. What I already tried:
I have tried contacting NameCheap support and asking for help from them(but nothing), read numerous posts on websites like Reddit, I have found a similar issue on GitHub but that sadly didn’t answer my problem.
6. Links to relevant resources:
opened 02:43AM - 05 Aug 20 UTC
closed 03:04AM - 05 Aug 20 UTC
question
documentation
I have been using Caddy locally on port 80 fine, I wanted to try HTTPS locally w… hich afaik requires using local certs, this works but for some reason continues to redirect to HTTPS despite the `auto_https disable_redirects` global option to prevent that.
**Config (Caddyfile):**
```
{
local_certs
auto_https disable_redirects
}
localhost
root * /usr/share/caddy
file_server
```
I run this via the official DockerHub image like so:
```
docker run -p 8000:80 -p 443:443 -v $PWD/public:/usr/share/caddy/ -v $PWD/caddy/data:/data -v $PWD/caddy/Caddyfile:/etc/caddy/Caddyfile caddy
```
Log output confirms that it's only listening on HTTPS:
```
2020/08/05 02:24:21 [INFO][cache:0xc00012a1e0] Started certificate maintenance routine
{"level":"info","ts":1596594261.8360162,"logger":"http","msg":"server is listening only on the HTTPS port but has no TLS connection policies; adding one to enable TLS","server_name":"srv0","https_port":443}
```
**Related logs following:**
```
{"level":"info","ts":1596594261.8360522,"logger":"tls","msg":"setting internal issuer for automation policy that has only internal subjects but no issuer configured","subjects":["localhost"]}
{"level":"warn","ts":1596594261.878241,"logger":"pki.ca.local","msg":"installing root certificate (you might be prompted for password)","path":"storage:pki/authorities/local/root.crt"}
2020/08/05 02:24:21 define JAVA_HOME environment variable to use the Java trust
2020/08/05 02:24:21 Warning: "certutil" is not available, install "certutil" with "apt install libnss3-tools" or "yum install nss-tools" and try again
2020/08/05 02:24:21 certificate installed properly in linux trusts
{"level":"info","ts":1596594261.9039123,"logger":"tls","msg":"cleaned up storage units"}
{"level":"info","ts":1596594261.9040866,"logger":"http","msg":"enabling automatic TLS certificate management","domains":["localhost"]}
{"level":"info","ts":1596594261.9041824,"msg":"autosaved config","file":"/config/caddy/autosave.json"}
{"level":"info","ts":1596594261.90419,"msg":"serving initial configuration"}
2020/08/05 02:24:21 [INFO][localhost] Obtain certificate; acquiring lock...
2020/08/05 02:24:21 [INFO][localhost] Obtain: Lock acquired; proceeding...
2020/08/05 02:24:21 [INFO][localhost] Certificate obtained successfully
2020/08/05 02:24:21 [INFO][localhost] Obtain: Releasing lock
2020/08/05 02:24:21 [WARNING] Stapling OCSP: no OCSP stapling for [localhost]: no OCSP server specified in certificate
```
So naturally..
```
curl localhost:8000
curl: (56) Recv failure: Connection reset by peer
```
Am I doing something wrong or unsupported here or is this a bug?
opened 06:19PM - 24 May 20 UTC
closed 04:56PM - 03 Jun 20 UTC
bug
```
:443 {
bind 95.216.178.135 2a01:4f9:c010:85b9::f00
tls {
on_demand…
}
}
```
On Port 80 on the IPv4 address, it fails:
```
$ curl 95.216.178.135 -v
* Trying 95.216.178.135:80...
* connect to 95.216.178.135 port 80 failed: Connection refused
* Failed to connect to 95.216.178.135 port 80: Connection refused
* Closing connection 0
curl: (7) Failed to connect to 95.216.178.135 port 80: Connection refused
```
On Port 80 on the IPv6 address, it works:
```
$ curl [2a01:4f9:c010:85b9::f00] -v
* Trying 2a01:4f9:c010:85b9::f00:80...
* Connected to 2a01:4f9:c010:85b9::f00 (2a01:4f9:c010:85b9::f00) port 80 (#0)
> GET / HTTP/1.1
> Host: [2a01:4f9:c010:85b9::f00]
> User-Agent: curl/7.70.0
> Accept: */*
>
* Mark bundle as not supporting multiuse
< HTTP/1.1 308 Permanent Redirect
< Connection: close
< Location: https://[2a01:4f9:c010:85b9::f00]/
< Server: Caddy
< Date: Sun, 24 May 2020 18:16:02 GMT
< Content-Length: 0
<
* Closing connection 0
```
This breaks redirects on IPv4-only machines.
```
$ caddy version
v2.0.0 h1:pQSaIJGFluFvu8KDGDODV8u4/QRED/OPyIR+MWYYse8=
$ uname -a
Linux srv01 4.19.0-9-amd64 #1 SMP Debian 4.19.118-2 (2020-04-29) x86_64 GNU/Linux
$ lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description: Debian GNU/Linux 10 (buster)
Release: 10
Codename: buster
$ sudo netstat -lntpuW | grep caddy
tcp 0 0 95.216.178.135:443 0.0.0.0:* LISTEN 14509/caddy
tcp6 0 0 2a01:4f9:c010:85b9::f00:80 :::* LISTEN 14509/caddy
tcp6 0 0 2a01:4f9:c010:85b9::f00:443 :::* LISTEN 14509/caddy
```
1. My Caddy version (caddy version):
v2.0.0-rc.3
2. How I run Caddy:
./caddy run
a. System environment:
Debian 9
d. My complete Caddyfile or JSON config:
{
debug
on_demand_tls {
ask "https://mydomain.com/ask"
}
}
#Listen
:443 {
reverse_proxy 127.0.0.1:81
#TLS Options
tls myemail@mydomain.com {
on_demand
}
}
3. The problem I’m having:
Hello, this config just works fine with https only. Now I also want to open port 80, and enable redirection to https. Is this possible with t…
Thanks for your time and effort.