Skip to content

Commit be21fc1

Browse files
authored
[SPA] Set accept header on HttpClient used in SpaProxyLaunchManager (#33135)
This unblocks other JS build tools for working as the frontend proxy.
1 parent fbf30e0 commit be21fc1

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/Middleware/Spa/SpaProxy/src/SpaProxyLaunchManager.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
using System.Diagnostics;
88
using System.IO;
99
using System.Net.Http;
10+
using System.Net.Http.Headers;
1011
using System.Threading;
1112
using System.Threading.Tasks;
1213

@@ -37,6 +38,9 @@ public void StartInBackground(CancellationToken cancellationToken)
3738
// It's ok for us to do this here since this service is only plugged in during development.
3839
ServerCertificateCustomValidationCallback = HttpClientHandler.DangerousAcceptAnyServerCertificateValidator
3940
});
41+
// Certain frontend build tools rely on the the ACCEPT Header being set, otherwise these tools
42+
// might be unable to perform their client-side fallback logic.
43+
httpClient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("*/*"));
4044
_logger.LogInformation($"No SPA development server running at {_options.ServerUrl} found.");
4145

4246
// We are not waiting for the SPA proxy to launch, instead we are going to rely on a piece of

0 commit comments

Comments
 (0)