Proxied DNS blocks server connections.
Excuse me if I don't understand something I am new to networking and security, I will try my best to explain the issue.
I'm currently working on a web application that requires a server backend. To avoid using the server's IPv4 address directly, I've set up a DNS A record to use a hostname instead. Everything works perfectly when the DNS setting is on 'DNS Only' mode. However, when I switch to 'Proxied' mode, I start encountering issues where I can no longer connect to the server, and I receive '400 Bad Request' errors.
I've experimented with various Cloudflare settings to resolve this issue but haven't had any success so far. Here are some of the things I've tried:
1. Turning off Cloudflare SSL/TLS.
2. Setting up various Cloudflare WAF settings to try unblock connections to the hostname.
3. Switching between Argo Tunnel and DNS Records.
I'm reaching out to see if anyone has encountered a similar issue or has any suggestions on what else I can try to resolve this problem. Any advice or guidance would be greatly appreciated. Thank you!
24 Replies
Have you checked your origin server? It might be that it isn't handling something correctly
I created and tried to use 'Origin Certificate' on my hostname and server but it didn't help, Would it be beneficial If I shared the python server and client code I am using to diagnose if It's a code related issue?
Yeah. Does it show any errors?
I'm guessing that the error is coming from the server
The same '400 bad request' error, I will grab the code 1 minute
No, I meant the server log
By server log you mean the full '400 request error' or something specific within CloudFlare?
The logs from your server(the python code). Not on Cloudflare
This is what I receive, Without the 'Proxied DNS' I get a "Hello World"
It's a very short python script I am testing this on, I can post it incase there is a method to include the certificate that I am not aware of.
Is that what your server is logging?
Your server shouldn't be logging a response
That is what the client is receiving from the server, the server doesn't print anything.
Here are the scripts for context:
server.py
client.py
I am unsure if my method of including the certification is correct, I had copied 'Origin Certificate' and the 'Private Key' into a text file and changed the file into .pem and .key
Oh it's not even reaching the server, I get no prints from the server at all so CloudFlare is blocking the access.
Just to check, since I'm not that well versed in Python, but this appears to be opening a TCP Socket, no?
Yes
Yeah, that's probably the issue. Your setup on Cloudflare is set for HTTP, not TCP
You can set up TCP connections, but that requires Spectrum
Which is probably not what you want, since it is pretty expensive
I am trying to locate 'CloudFlare Spectrum', It's not showing up on my account dashboard
https://dash.cloudflare.com/?to=/:account/:zone/spectrum, it requires a Paid Plan
Though again, I wouldn't recommend it for a small project
I had just converted the python script to an http protocol, Same '400 Bad Request' issue 😢
Spectrum won't solve the issue
Ok, so you are running without a Tunnel. Just to be clear, what URL are you attempting to hit?
I'm going to guess
http://your.domain.com:443/
?
Or something similar?With tunnel. direct IPv4 works fine but switching to the tunnel URL gets blocked by CloudFlare
Yes
http with port 443?
http://tunnel.domain.com:2053 ('domain.com' is a placeholder)
What happens if you just do http://tunnel.domain.com/ ?
It appears that it expects 2053 to be over HTTPS, but you are forcing it to try HTTP, causing it to error
Unfortunately I am unable to start an http website on port 80 for some reason, Also I have to go to my day job.
Thank you for trying to help me! When I will come back I will try to solve the issue and post the solution 💪 .
The port on your server doesn't matter as much if you are using Tunnels. You can point the Tunnel at the port, then it will automatically be translated to port 80 and 443
I am back. I have created an HTTP website on port 80, but I am still getting the connection blocked by CloudFlare. Maybe I don't know how to configure my CloudFlare settings correctly.
I tried an alternative service and successfully created a reverse proxy for my server.
I will continue using CloudFlare for the website and configure the server backend using the alternative service.
@HardlyWorkin' Thank you for your time and effort in trying to help me. 🙏🙏🙏