I’m pretty new to web development, I might talk non-sense. After following some tutorials I’ve found a way to deploy a Blazor webapp on Netlify. For that I’m using a DotNet action on Github. It works almost perfectly, here is is the link: https://chefty.netlify.com. The thing is, my website is blocked by my antivirus (Avast). Page is stuck on “Loading…” blank screen saying “An unhandled error has occurred. Reload”. I ended up looking for solutions and found out that it could come from the fact I’m missing a _headers file. People were also advising to add a _redirects file. So I added those to the root of my website, next to index.html:
_headers
I also used this website https://securityheaders.com to test my url headers and I get a D grade… When I check my github action workflow those two files are there, in the dist folder I deploy. Then when I dot Inspect element sources on my page, there files are missing, no idea why. Any help would be much appreciated !
Heya, welcome! Can you share your file structure and/or a link to your repo (if it’s public)? At first glance, it looks like your header attributes aren’t indented, so that could be part of the problem for that file. Have you tried something like:
Hi ! Thank you. Sure, here is my repo: https://github.com/Chefty/Portfolio.
I think the indentation should be ok with my files ? I followed this thread to be sure.
I checked if the files were there by doing a right click on my webpage then, inspect element, in the sources tab. I can see the index and other folders but no _headers or _redirects files.
About Netlify continuous deployment due to the fact my website is not static I can’t use it. It needs to build to re-update everything. I use Github workflows action, you can check it out in my repo in .github/workflows/dotnetcore.yml. I hope you can find what I am doing wrong there…
I’m not super familiar with this framework so take this guidance with that grain of salt, but scanning this tutorial, it seems like there is a build to /dist folder step that is missing from your setup. I see in your Github actions yaml that you’re deploying a Portfolio/dist directory to Netlify, but I’m not able to see that in your repo anywhere. Can you confirm that when you create that directory locally, it contains your _redirects and _headers files?
I’ve already been through this tutorial and I guess It might solve my problem to deploy my project this way. Although I would be a bit disappointed to give up all the time I spent trying to setup this automated workflow to build/deploy from Github to Netlify on every commit. In the end, I’m not even sure those two files are what causing Avast antivirus blocking my website…
Also, I did check if my Portfolio/dist build folder was containing those files and it does, here is a screenshot:
It is the first three bytes (ef bb bf) causing this issue. If you delete those three bytes from this file, the headers will begin working.
Yes, I spend time doing binary (or hexadecimal in this case) analysis of text files. Why would I do such a thing? Because I’ve seen this root cause before.
Hi, sorry for the late reply, I ended up using a Github Page for my website…
Thanks anyway @luke for your help, it fixed my issue !
Now I got a B grade on https://securityheaders.com and the website is not anymore blocked by my antivirus.