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:
EXPOSE 4000
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!
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!
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> {
reverse_proxy 127.0.0.1:4000
}
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:
https://caddyserver.com/docs/caddyfile/directives/reverse_proxy
Let me know how it goes!
Best,
Bobby
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.