Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/dotnet/spa-templates.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJavier Calvarro Nelson <jacalvar@microsoft.com>2021-11-23 20:34:41 +0300
committerGitHub <noreply@github.com>2021-11-23 20:34:41 +0300
commitfc3ec4900d35dd00058e45aec6fbc8034696c5e5 (patch)
tree36149edfd96566fe5ad620cfccde04f3c31e87ce
parentc9c37efcb3bdccbc18c1e65774ae9655543c2ffb (diff)
[SPA] Add Keep-Alive header to avoid browser console errors on Mac and Linux (#27)
-rw-r--r--src/content/Angular-CSharp/ClientApp/proxy.conf.js5
-rw-r--r--src/content/React-CSharp/ClientApp/src/setupProxy.js13
2 files changed, 12 insertions, 6 deletions
diff --git a/src/content/Angular-CSharp/ClientApp/proxy.conf.js b/src/content/Angular-CSharp/ClientApp/proxy.conf.js
index 14ce379..bbbf0b7 100644
--- a/src/content/Angular-CSharp/ClientApp/proxy.conf.js
+++ b/src/content/Angular-CSharp/ClientApp/proxy.conf.js
@@ -17,7 +17,10 @@ const PROXY_CONFIG = [
//#endif
],
target: target,
- secure: false
+ secure: false,
+ headers: {
+ Connection: 'Keep-Alive'
+ }
}
]
diff --git a/src/content/React-CSharp/ClientApp/src/setupProxy.js b/src/content/React-CSharp/ClientApp/src/setupProxy.js
index 8a2936e..0b71628 100644
--- a/src/content/React-CSharp/ClientApp/src/setupProxy.js
+++ b/src/content/React-CSharp/ClientApp/src/setupProxy.js
@@ -23,12 +23,15 @@ const onError = (err, req, resp, target) => {
module.exports = function (app) {
const appProxy = createProxyMiddleware(context, {
target: target,
- //by handling errors, we prevent the proxy middleware from crashing outright when
- //the ASP NET Core webserver is unavailable, for example if it has been restarted
+ // Handle errors to prevent the proxy middleware from crashing when
+ // the ASP NET Core webserver is unavailable
onError: onError,
- secure: false
- //uncomment this line if using websockets
- //ws: true
+ secure: false,
+ // Uncomment this line to add support for proxying websockets
+ //ws: true,
+ headers: {
+ Connection: 'Keep-Alive'
+ }
});
app.use(appProxy);