-
Notifications
You must be signed in to change notification settings - Fork 10.3k
Refused to load _framework/aspnetcore-browser-refresh.js
due to CSP
#33068
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
We've moved this issue to the Backlog milestone. This means that it is not going to be worked on for the coming release. We will reassess the backlog following the current release and consider this item at that time. To learn more about our issue management process and to have better expectation regarding different types of issues you can read our Triage Process. |
@pranavkm is this something that you've been looking at? |
Some one said my error related to this issue: https://stackoverflow.com/a/69252946/3728901 |
Related to: #34428 @pranavkm is the |
_framework/aspnetcore-browser-refresh.js
due to CSP
The script has a couple of dynamic components which makes this tricky. I think one of the ideas was to Browserlink in VS which is now injected by default also has this issue, so we kinda have to make sure this scales (or figure out how to roll everything into a single import). |
As mentioned previously (twice!) here's my debug info of what's going on. Looks like the port used for the refresh is dynamically set and thus cannot easily be placed in a CSP rule at development time. There's no way to set the port, or to use a common one for all VS installations. A solution might be to use a different endpoint on the existing site for refresh functionality rather than try to connect to a different port. |
to allow this while developing alter the CSP header on the response of the page. My Nuget Package walter.web.firewall will do this for you |
I faced the same issue and added: "default-src 'self' 'unsafe-eval'". It is a temporary fix though. I wish we had a proper fix to avoid the 'unsafe-eval' line. |
There is a way to disable the injection of the aspnetcore-browser-refresh script using configuration settings. Basically the script is injected by a middleware which is injected using hosting startup assemblies. You can disable the specific hosting startup assembly using this code:
Or using an environment variable |
Thanks for contacting us. We're moving this issue to the |
We use 'strict-dynamic' with nonce attributes on all our scripts which precludes the use of 'self'. Perhaps nonces need baking into the MVC framework :-) |
Thanks for contacting us. We're moving this issue to the |
I am working on the Microsoft Learn tutorials, and this is still an issue https://learn.microsoft.com/en-us/training/modules/dotnet-microservices/5-exercise-create-docker-compose-file
|
Closing as this will be handled as part of #45213 |
I'm working on
.net 5 blazor wasm
project. I recently updated myVisual Studio 2019
to version16.10.0
. All of a sudden I started getting an error message in my browser (Google Chrome)console
as shown below:I don't have
_framework/aspnetcore-browser-refresh.js
added in myindex.html
. Here is the scripts and styles declaration in myindex.html
styles
declared inside<head>
inindex.html
:scripts
inindex.html
:But when I launch the app via
visual studio
, from the browser I can see that_framework/aspnetcore-browser-refresh.js
gets appended to scripts section in myindex.html
. Here is the screen print.This is anything related to my configuration error? or I need to setup CSP in my
index.html
? Please assist.Further technical details
The text was updated successfully, but these errors were encountered: