modified to use proper proxy protocol