nginx with proxy protocol , ssl handshake failed

Posted January 2, 2020 4k views
NginxLoad Balancing

Hello everyone ,

I have a nginx webserver behind DO Loadbalance I have around 12 domains in my webserver some domains direct to Loadbalnce’s IP directly and other redirect to it via cloudflare
recently I faced a problem to get client’s Real IP for domain that redirect to the server directly without cloudflare .

I search on this issue and I found that I have to enable Proxy Protocol on the LoadBalance then I have to configure the nginx to accept Proxy Protocol

I follow this tutorial

and I got it done .

but if I add this directive to domain’s nginx configure files

listen 80 proxy_protocol;

all other domains on cloudflare got error ssl handshake failed and not working

how to get proxy_protocol directive work without effect on other domains ?

thank you so much .

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.

Submit an Answer
1 answer


It sounds like that you’ve managed to fix the first part but now there is an issue with the Cloudflare SSL. What I could suggest here is trying to change your CloudflareSSL from Full to Flexible.

For more information about the difference, you could take a look at the official Cloudflare documentation here:


Hope that this helps!