Reverse proxy + http->https redirect

1. Caddy version ('2.3`):

2. How I run Caddy:

running service on port 8080
need to reverse proxy and also redirect http>https

a. System environment:

ubuntu 18.04

b. Command:

caddy start

c. Service/unit/compose file:

?

d. My complete Caddyfile or JSON config:

site.com
reverse_proxy localhost:8080

3. The problem I’m having:

The site does work when browsing https://site.com
However, if you enter http://site.com it fails
I would like the http to redirect to https

4. Error messages and/or full log output:

5. What I already tried:

i’ve tried setting the reverse_proxy to ‘http://localhost:8080

I feel this is something simple I am missing, but having a hard time finding a documented solution.
Thanks!

What do you mean by “fails”? Please be specific.

Are you sure you have ports 80 and 443 open and publicly accessible? What are in your logs? Run journalctl -u caddy --no-pager | less to see them.

1 Like

PEBKAC error

80 was not open on AWS security group. All seems good now. Also removed 8080 being open.

1 Like

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