Reverse_Proxy Custom URL

1. Caddy version (caddy version):

v2.2.1 h1:Q62GWHMtztnvyRU+KPOpw6fNfeCD3SkwH7SfT1Tgt2c=

2. How I run Caddy:

a. System environment:

Windows 10 PC with Ubuntu WSL, Caddy in Ubuntu WSL

b. Command:

caddy run

c. Service/unit/compose file:

d. My complete Caddyfile or JSON config:

wsl.files.local

reverse_proxy localhost:8080

3. The problem I’m having:

I am trying to proxy from a custom url (like wsl.files.local) to localhost:8080, which is running a filebrowser. It works if I just proxy a Port like from localhost:4200 to localhost:8080.

4. Error messages and/or full log output:

No Error messages

5. What I already tried:

6. Links to relevant resources:

What’s in your logs? What behaviour are you actually seeing? Do you have a DNS server or /etc/hosts entry mapping wsl.files.local to the right IP address?

Logs:

2020/11/27 21:34:53.469 INFO    using adjacent Caddyfile
2020/11/27 21:34:53.471 INFO    admin   admin endpoint started  {"address": "tcp/localhost:2019", "enforce_origin": false, "origins": ["localhost:2019", "[::1]:2019", "127.0.0.1:2019"]}
2020/11/27 21:34:53.471 INFO    http    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}
2020/11/27 21:34:53.471 INFO    http    enabling automatic HTTP->HTTPS redirects        {"server_name": "srv0"}
2020/11/27 21:34:53.471 INFO    tls.cache.maintenance   started background certificate maintenance      {"cache": "0xc00025c150"}
2020/11/27 21:34:53.478 INFO    tls     setting internal issuer for automation policy that has only internal subjects but no issuer configured  {"subjects": ["wsl.files.local"]}
2020/11/27 21:34:53.483 INFO    tls     cleaned up storage units
2020/11/27 21:34:53.517 INFO    pki.ca.local    root certificate is already trusted by system   {"path": "storage:pki/authorities/local/root.crt"}
2020/11/27 21:34:53.517 INFO    http    enabling automatic TLS certificate management   {"domains": ["wsl.files.local"]}
2020/11/27 21:34:53.518 WARN    tls     stapling OCSP   {"error": "no OCSP stapling for [wsl.files.local]: no OCSP server specified in certificate"}
2020/11/27 21:34:53.519 INFO    autosaved config        {"file": "/home/erik/.config/caddy/autosave.json"}
2020/11/27 21:34:53.519 INFO    serving initial configuration

URL proxy doesn’t seem to do anything but port proxy works as intended.

I am quite a newbie to the community and basically don’t ave any experience concerning DNS issues.

I have nothing else installed in my wsl other than caddy and the filebrowser right now. I only use this Caddyfile right now.

Caddy isn’t a DNS server, so there’s nothing on your system to tell your browser that you want wsl.files.local to map to 127.0.0.1, i.e. same as localhost.

You should read this article:

This assumes you want to make your server publicly accessible though.

Ultimately, Caddy is not the problem here, you just need to go out and learn how DNS works. The internet has lots of resources on the topic, just go look for them :slight_smile:

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