Best way to use Caddy with 2 Go servers on the same machine

Hi,

I have got 2 Go web servers (labstack/echo) running on the same machine (one is for the web page and the other is for admin area). My server has to public IP addresses for each web site (web server).

Now, I want to be able to use HTTPS for both sites, and after researching and reading a lot of material, I cam to conclusion that Caddy seems to be the perfect fit for my requirements. So my question is as follows:

Should I use Caddy as a proxy to forward the requests onto each server depending on a subdomain, or should I embed Caddy into my web servers?

I tried to use caddy as a forwarding proxy with this caddyfile

http://admin.localhost:6060 {
log stdout
	errors stdout 
	bind {$ADDRESS}
	proxy / 127.0.0.1:8080 {
		transparent
	}
}

http://front.localhost:6060 {
log stdout
	errors stdout 
	bind {$ADDRESS}
	proxy / 127.0.0.1:7070 {
		transparent
	}
}

but it is not forwarding at all. I am sure it is probably something that I am missing as I am total beginner in Caddy.

Any help would be appreciated

Regards

Fitim

What do you mean by this? What errors are you getting?

Hi Matt,

I get the following on the console screen:

$ caddy_windows_386.exe
Activating privacy features... done.
http://admin.localhost:6060
http://front.localhost:6060

but when trying to browse to http://admin.localhost:6060 using web browser (google chrome) I get 503 with “The page cannot be displayed”

Out of curiosity, any reason why you need bind {$ADDRESS} ?

Do the two Go servers respond properly when you access them directly ?

Finally, enable access and error logs and share the output.

Hi,

The only readon for using bind is because I saw an exmple that uses it. the servers can be accesed directly without any problem.

How would I enable access and logging? Please bear with me as I am totally new to Caddy.

Regards

Fitim

log access.log and errors error.log will write access and error log files. You may also want to run Caddy with -log process.log to get a detailed process log (for items not related to requests).

And in general there are awesome docs at: Welcome — Caddy Documentation

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.