'How to solve Error 520 original error in Codeigniter?

My Codeigniter package connected with Cloudflare. If my package connected with Cloudflare. It's not working and it shows "Error 520: Web server is returning an unknown error".Error 520 original error

Without Cloudflare it's working fine.



Solution 1:[1]

I logged in, and it worked. Then, I logged out and tried to login again and I saw the 520 error you're talking about.

I think it has something to do with your redirect URL.

https://www.plac24.com/user/login?rdr=http%3A%2F%2Fwww.plac24.com%2F

As you're redirecting them to your website, do you need the http://?

Solution 2:[2]

I'd like to add my fix for my 520 issue with Cloudflare. I had a content security policy set up on my nginx server configuration in nginx.conf.

add_header Content-Security-Policy "default-src 'self' https://www.google-analytics.com ;  
img-src 'self' https://*.ggpht.com ;

I had inserted a line break into this header and never noticed or cared because it worked on all browsers. Removing my line breaks to look like the below resolved my issues.

add_header Content-Security-Policy "default-src 'self' https://www.google-analytics.com ;  img-src 'self' https://*.ggpht.com ;

You probably won't run into the exact issue as me, but the lesson here is to check your headers and try to selectively remove them until you can isolate or rule out these as issues. Hopefully this can save you $20 for a cloudflare support subscription.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1
Solution 2 Ryan McGrath