Blazor Server Side app not working when Cloudflare is enabled

Hello, I just registered a domain and configured a httpserver to serve my Blazor Server App

Everything works just fine until I redirect my dns to cloudflare’s.

Now every request is proxied through cloudflare and my website never loads.

It always says: error, too many redirects

If I disable the proxied connection in cloudflare’s DNS, it works again.

Gooling I found that I need to disable minification but in cloudflare’s docs it says it’s deprecated because they’re migrating their Page Rules system, and no matter if I still disable it while deprecated, it just doesn’t work.

I even created a new Rule disabling one by one each setting and none of these settings did anything. I even disabled all at once but nothing.

I don’t know what else to do.

Somebody knows? Blazor Server is not compatible with Cloudflare at all?

I read in the docs that Blazor WASM is compatible but Server it seems not, but I’m not sure if that’s for those deployment doc I read or for all Cloudflare’s services.

Check your SSL/TLS setting is set to “Full (strict)” in your dashboard here…
https://dash.cloudflare.com/?to=/:account/:zone/ssl-tls

2 Likes

For a momment I thought it worked, but I was using the cache so the website was loading just fine

The problem persists.

nginx config looks like this:

server {
    server_name mydomainname;

    location / {
        proxy_pass      http://localhost:50000;
        include         proxy.conf;
    }

    listen 443 ssl; # managed by Certbot
    ssl_certificate /etc/letsencrypt/live/mydomainname/fullchain.pem; # managed by Certbot
    ssl_certificate_key /etc/letsencrypt/live/mydomainname/privkey.pem; # managed by Certbot
    include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
    ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
}

server {
    if ($host = mydomainname) {
        return 301 https://$host$request_uri;
    } # managed by Certbot

    listen 80;
    server_name mydomainname;
    return 404; # managed by Certbot
}

Kestrel server is running on port 50000

HttpsRedirection is disabled on Blazor project so all SSL stuff is handled by nginx and cloudflare

But the problem persists if I enable cloudflare.

Is the Cloudflare SSL setting still on “Full (strict)”? You need to keep that as “Flexible” will always give circular redirects if you are redirecting to https on your origin.

Can you give the hostname?

1 Like

I found the problem.

First, yes, I changed it to Full (strict) and I thought it worked but it was a cached response, so I tried fetching the website in incognito and it failed.

Then I saw I forgot to delete some rules I applied when I was testing some options.

Now I deleted those rules and purged the cache, now it works properly. Thank you so much.

2 Likes

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