Cloudflare is returning an error 520 when my web server issues HTTP 302

What is the name of the domain?

arbel.gr

What is the error number?

520

What is the error message?

Web server is returning an unknown error

What is the issue you’re encountering

Cloudflare is returning an error 520 when my web server issues a redirect (HTTP 302)

What are the steps to reproduce the issue?

To reproduce: access https://arbel.gr/redirectme.

Or curl it:
[curl -v arbel.gr/redirectme* Host arbel.gr:80 was resolved.* IPv6: (none)* - Pastebin.com]

Compare this with accessing the raw IP, bypassing Cloudflare:

[curl -v 15.156.205.117/redirectme* Trying 15.156.205.117:80...* Connected - Pastebin.com]

It’s not clear to me why Cloudflare calls this an “unknown error”. All I’m trying to do is send 302 Found.

I cannot reproduce the same error anymore.
Your Website is working fine from me end, using Cloudflare nameservers and DNS records proxied :orange: .
Could you confirm? :thinking:

Furhtermore, may I ask which steps for troubleshooting 520 error have you tried already?

@fritex Thanks for the reply! To troubleshoot I tried tweaking the HTTP status code and I found that HTTP 303 returned the same error. Unfortunately Cloudflare is very vague and isn’t explaining exactly what’s wrong (e.g. “invalid HTTP format”). Maybe I will experiment some more. But you said you’re able to access https://arbel.gr/redirectme - could you share what output you get when you curl the page?

curl -v arbel.gr/redirectme

Here’s what I’m seeing:

I figured it out!

I need to have the string \r\n\r\n (two newlines) after the response. It wasn’t working because I only had one newline. I’m not sure why Cloudflare has this requirement but I hope this helps someone!

1 Like

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