-
Notifications
You must be signed in to change notification settings - Fork 10.3k
Performance issue in UseProxyToSpaDevelopmentServer #18062
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
Looks like the issue is related to this one: #16797 |
Do you know if the linked issue resolves your problem? |
@pranavkm I grab the latest code and does not seem help, it does not resolve my problem. |
This issue has two parts:
const http = require('http');
const server = http.createServer((req, res) => {
res.writeHead(200, {'Content-Type': 'text/plain'});
res.end('OK!');
console.log('YEAH~');
})
server.listen(5000, 'localhost'); For reason unknown, just replace the So, for reason unknown, I just need to replace the |
Do you mean the HttpClient used by the spa extensions? There is no singleton HttpClient AFAIK on the SPA extensions, I'm not sure if it uses its own HttpClient and keeps it around or if it creates a new one every time. With regards to the ETag / If-None-Match i don't think HttpClient has logic to handle those things or that we implement our own. Best case scenario, the OS handles it for you, but I don't think that's the case.
Is this code on the template? I'm not sure why localhost might be different than 127.0.0.1 but maybe the OS/network stack takes some kind of shortcut. @Tratcher is this something you know about? |
Localhost tries IPv6 first (::1) and takes seconds to time out before trying IPv4. I assume the server is only listening in IPv4? |
@Tratcher Very likely. Do you see any downside to hardcoding |
shrug it's better to fix the server if possible. |
@Tratcher I don't think we can fix the underlying webpack/node server. I'm not sure this is an issue in the general case either. |
But |
@Tratcher nop, as I said, |
@Tratcher @javiercn aspnetcore/src/Middleware/SpaServices.Extensions/src/AngularCli/AngularCliMiddleware.cs Lines 46 to 52 in 968e85a
|
If @Tratcher is happy with the solution to change it to 127.0.0.1, I believe we would be happy to take a PR for this change. |
That's fine. |
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. |
This is a dupe of #22769 We recommend following the guidance offered there to avoid this issue. |
Uh oh!
There was an error while loading. Please reload this page.
UseProxyToSpaDevelopmentServer
causing a lot of time to forward the request.The raw
webpack
/ng serve
server is pretty fast, should be processed within100ms
, butUseProxyToSpaDevelopmentServer
API have to wait for 4 seconds to handle this request.To Reproduce
Create a angular
SPA
project (based on.NET Core 3.1
), modify theStartup.cs
, changeUseAngularCliServer
toUseProxyToSpaDevelopmentServer
and hitCtrl+F5
to run directly(and runng serve
in front-end folder at same time).Checkout the browser

F12
, should see this:When using raw

webpack
/ng serve
command without proxy(http://localhost:4200
), performance is much better:Further technical details
The text was updated successfully, but these errors were encountered: