-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Description
Is there an existing issue for this?
- I have searched the existing issues
Describe the bug
Because Blazor seems to depend on there being certain HTML comments in the rendered pages, it does not work with proxy services like CloudFlare, who auto-minify the HTML by default, which strips out the comments.
The HTML comments look like this:
<!--Blazor:{"type":"server","prerenderId":"39159892b4704d6db6ea99a0cb49f21e","key":{"locationHash":"935B039C37E40B335A69429DE8D78773E8592D739142BA018164F9F93C019F8F:0","formattedComponentKey":""},"sequence":0,"descriptor":"CfDJ8LoRvC53WPxKtDP68xGIRLvPCZ3NrW\u002BzOEXCC/EEfNB5anYI88s7bitx1THCrgTp789FrrtjlSPKAwX32CagxQ09iPYtrA4soJylLKZjcJGAXVaE/70XGAvGTm3zxXNQP/EcGoNHWUwF99aMxPZZ6r/83JA6Ie\u002BSd8JqjkSJ2\u002B1vLi8r6sJU560uSnTSsZ5Yf6hG4m00OfbmHhJnUjGjCjFHsuOPykylSqhd0q5/hDJLIWilYgMx/\u002BB0UbLwphTq6hL6tkvKyDZ4hB93AuoXWU7XzHr82AvlN1l6cYv22wphaJoDM9jAfoFXckPv9dOrEDontfZVIMWzN3WnX/sKp8N4FGRmy3fVo/VQZNtFQp\u002BPMwAHTKnMNFUd3D6lGdH53CTak/Z\u002BeNuG/wtLbqXG/w3LN9pdgBh\u002BBIkW41rMbm8qy4BB9rZP94M5YSPLQ2MWkJk9EhYh1eizm\u002BTS23iu9iufTAk9yX0QwfvyY4HEAzJRKTpvGa98VocUXMb8K\u002BlsYjStgpptFDChU9DidbDte/Jov9\u002BggWSn8unf5Wzb0\u002BttVs\u002BWYEtSnKbaQLu19zs5FaMmUS6vjVgFBw/PqUfAQVm\u002BvGIOxobbPWDX0B7X8Ii6JMVf3wfbLcQPbPdtikJNHwgrwMiCfGxYxhj4DnmuuK1p6eLP6G5NfxDTiO7ecY/lRCHpype1Uh01AjrRfhhRmaqUR3oSkqzoIw/PtBHh9isVxP3to6/u5w1m2GCfDmeV6yKVF6Qqrd\u002B2To7iotCI0Ov0cktAce\u002B2g6ic2\u002B\u002BoNwV01YybH1x1n1svb9VCabAGNNoMsKeXzDWSQLCuWMqQIfTBDZ43WDh6QOyOoiVOmb01COy78lOUelzNfkTmJ7WNA8CyAtAnjNbnLLUXOoY8l5/HXfK5zyQjTZb5J2keIOmLyxzXAH4R3eJmIkL1B/LrlHjH5nh5z6hzPm29cS0g1bogafk5DrjO3lWSBMeFtv0="}-->
The issue is best described by these sources:
blazor server app behind cloudflare does not work
Blazor Server events not triggering when hosted behind Cloudflare
This seems like a serious issue and there is no indication in the browser's developer tools (like JS exceptions or other errors) that indicates something like this is going on.
Needless to say, it took me a very long time to arrive at the actual cause.
The workaround is to disable auto-minification for the site in question, but this feels like a hack.
It's really odd for a framework to depend on there being HTML comments in the DOM.
Expected Behavior
I expect the Blazor application to work.
Steps To Reproduce
- Create Blazor Server Application
- Add dynamic .razor page (or use the counter example)
- Proxy the application through CloudFlare
- It does not update dynamically. Only static content displays.
Exceptions (if any)
No errors are logged whatsoever. Nether on the client side nor server side.
.NET Version
8.0.0
Anything else?
No response