Skip to content
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

[browser] Don't cache index.html during development #111268

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion src/mono/wasm/host/DevServer/DevServerStartup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@
ServeUnknownFileTypes = true,
});

app.UseRouting();
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This call was a duplicate (see line 61)

app.UseWebSockets();

if (options.OnConsoleConnected is not null)
Expand Down Expand Up @@ -100,6 +99,14 @@
{
OnPrepareResponse = fileContext =>
{
// Avoid caching index.html during development.
// When hot reload is enabled, a middleware injects a hot reload script into the response HTML.
// We don't want the browser to bypass this injection by using a cached response that doesn't
// contain the injected script. In the future, if script injection is removed in favor of a
// different mechanism, we can delete this comment and the line below it.
// See also: https://github.com/dotnet/aspnetcore/issues/45213
fileContext.Context.Response.Headers[HeaderNames.CacheControl] = "no-store";

Check failure on line 108 in src/mono/wasm/host/DevServer/DevServerStartup.cs

View check run for this annotation

Azure Pipelines / runtime (Build browser-wasm linux Release MultiThreaded_BuildOnly)

src/mono/wasm/host/DevServer/DevServerStartup.cs#L108

src/mono/wasm/host/DevServer/DevServerStartup.cs(108,58): error CS0103: (NETCORE_ENGINEERING_TELEMETRY=Build) The name 'HeaderNames' does not exist in the current context

Check failure on line 108 in src/mono/wasm/host/DevServer/DevServerStartup.cs

View check run for this annotation

Azure Pipelines / runtime (Build browser-wasm linux Release SingleThreaded_BuildOnly)

src/mono/wasm/host/DevServer/DevServerStartup.cs#L108

src/mono/wasm/host/DevServer/DevServerStartup.cs(108,58): error CS0103: (NETCORE_ENGINEERING_TELEMETRY=Build) The name 'HeaderNames' does not exist in the current context

Check failure on line 108 in src/mono/wasm/host/DevServer/DevServerStartup.cs

View check run for this annotation

Azure Pipelines / runtime (Build wasi-wasm linux Release WasmBuildTests)

src/mono/wasm/host/DevServer/DevServerStartup.cs#L108

src/mono/wasm/host/DevServer/DevServerStartup.cs(108,58): error CS0103: (NETCORE_ENGINEERING_TELEMETRY=Build) The name 'HeaderNames' does not exist in the current context

Check failure on line 108 in src/mono/wasm/host/DevServer/DevServerStartup.cs

View check run for this annotation

Azure Pipelines / runtime

src/mono/wasm/host/DevServer/DevServerStartup.cs#L108

src/mono/wasm/host/DevServer/DevServerStartup.cs(108,58): error CS0103: (NETCORE_ENGINEERING_TELEMETRY=Build) The name 'HeaderNames' does not exist in the current context

if (options.WebServerUseCrossOriginPolicy)
{
// Browser multi-threaded runtime requires cross-origin policy headers to enable SharedArrayBuffer.
Expand Down
Loading