Skip to content

Instantly share code, notes, and snippets.

@andrewhamon
Last active June 12, 2016 05:07
Show Gist options
  • Save andrewhamon/ae3bfbd66420bc3e1147e2bc0ece08d6 to your computer and use it in GitHub Desktop.
Save andrewhamon/ae3bfbd66420bc3e1147e2bc0ece08d6 to your computer and use it in GitHub Desktop.
Reproducing the bug described in https://github.com/mholt/caddy/pull/880
localhost:80
proxy / server_1:8080 server_2:8080 server_3:8080 {
policy round_robin
health_check /healthcheck 1s
}
version: '2'
services:
server_1:
build: .
environment:
- SERVER_NAME=server_1
server_2:
build: .
environment:
- SERVER_NAME=server_2
server_3:
build: .
environment:
- SERVER_NAME=server_3
caddy:
image: abiosoft/caddy
ports:
- "80:80"
volumes:
- ./Caddyfile:/etc/Caddyfile
depends_on:
- server_1
- server_2
- server_3
FROM node
COPY server.js .
CMD node server.js
var http = require('http')
var numRequests = 0
function handleRequest(request, response){
if(request.url == "/healthcheck"){
response.end("Healthcheck OK")
} else {
numRequests++
response.end(process.env.SERVER_NAME + ' requests: ' + numRequests);
}
}
var server = http.createServer(handleRequest)
server.listen(8080);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment