Web app not working with Caddy

Hi all,

I’ve created a droplet using the 1-click installer with Docker to install a Golang app that starts a server in port 4000 and I’m doing this in my production stage Dockerfile:

ENTRYPOINT ["./app"] --port 4000

However after running the Dockerfile and making sure the server is running, I want to go to my droplet IP address to make sure it worked, but it just shows the Caddy static website. However, going to the IP:4000 shows my app.

What do I need to do in order to see my web app in the default 80 port? Thanks!

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Bobby Iliev
Site Moderator
Site Moderator badge
May 18, 2024

Hi there,

I believe that you need to configure Caddy to reverse proxy requests from port 80 to your Go app on port 4000.

To do that you have to update your Caddy config file and add a reverse proxy rule, eg:

http://<your-droplet-ip> {

Just replace the <your-droplet-ip> with your actual Droplet IP address and then restart Caddy:

sudo systemctl restart caddy

After that you should be able to access your web app by navigating to your Droplet’s IP address in the browser without specifying port 4000.

For more information on reverse_proxy config, you can check the documentation here:

Let me know how it goes!



Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Featured on Community

Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Hollie's Hub for Good

Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.

Become a contributor

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

Welcome to the developer cloud

DigitalOcean makes it simple to launch in the cloud and scale up as you grow — whether you're running one virtual machine or ten thousand.

Learn more
DigitalOcean Cloud Control Panel