Search code examples
c#blazor.net-5cloudflare-pages

.Net Blazor(.Net 5) on Cloudflare Pages?


I just saw that Cloudflare pages are supporting .net blazor and I was wondering, how this is possible? If I want to connect via Blazor to my database or anything else, the credentials would be public, if I understand that? Or do I have to separate Blazor with the API Backend or can Blazor do that for me? Or shouldn't I use blazor as a Backend Solution?

Thanks, Florian


Solution

  • Cloudflare pages is for static web site, they only serve files built during compilation phase. Here, this mean Blazor WASM (compare to Blazor Server Side).

    Blazor WASM web site must obtain authentication token from API server.

    You don't connect to your database directly, you'll use another API server to "proxy" the database access. The API will require the authentication token. This token usually contains user identity and his secure.

    Look at https://jwt.io/introduction