-
Notifications
You must be signed in to change notification settings - Fork 524
Kestrel + Proxying ( nginx/browsersync/etc ) = No response #636
Comments
@CesarBS lets move the convo here. |
What version of Kestrel are you using? |
RC1 |
I've been having this exact problem and been pulling my hair out trying to fix it. IT seems like Kestrel in this context is sending as Closing kestrel while browserSync is waiting kills the connection and the browser starts trying to use what it did download. |
@replete Use WebListener, its a known bug that is fixed already in master but not published |
@amcdnl Thanks, I did figure this out on my own in the end. As an aside, do you personally feel that it is anywhere near a good time for someone to start moving from an (incomplete) RC1 project to RC2? |
@replete its not for the light hearted....
|
@amcdnl Have you tried this with the latest Kestrel from the dev feed? |
@CesarBS I have not, I actually dropped browsersync recently too. If you wanna do a quick test, you can grab this gulp plugin I wrote and drop in browsersync: https://github.com/Swimlane/gulp-dotnet |
@amcdnl I recently had to give up on this (for the time being as well). I'm guessing it's because Kestrel & Node just don't play well together yet?? |
@MarkPieszak you can use weblistener. Its not just Node, I tried nginx too and had same issue. Its basically anything other than a browser ( proxy in these cases ) receiving the requests. This is claimed to be fixed in latest but have not personally tried. |
How do you set up weblistener in .NET core? I see the options for IISExpress & Web (kestrel) but nothing for weblistener. Oh I'll have to try it again today to see if it's actually fixed! |
In Project.json
|
Oh excellent, so it all works with that? That's amazing I'll just use that for the time being then. :) |
@CesarBS |
@CesarBS I updated Friday to RC2 and can concur with @peterblazejewicz regarding issues proxying. I also tried the suggestion to I'm running a NGINX server that serves my requests from NGINX config
Versions
I also have a rule setup to proxy @muratg why is this marked backlog in 1.0.0? This is HIGH priority, you can not deploy in a real world scenario with this not working! I see some other issues related saying to set the Related Issues |
+1 Very noticable |
I've figured out what's wrong. Right now, Kestrel will only listen on IPv4 when you bind to localhost. If you look at the network traffic when reproing this issue, you'll see nginx trying to establish an IPv6 connection with Kestrel, failing, waiting for The delay after the IPv6 failure is out of our control (Kestrel doesn't even see the connection attempt). @Tratcher has pointed out to me that this is a known issue with winsock - it takes a long time for it to realize a connection failure on IPv6 before trying IPv4. I'm going to fix #231 so binding to localhost will not cause this issue because Kestrel will be listening on both IPv4 and IPv6. For now you can workaround by either listening on both |
@amcdnl If you bind Kestrel to both |
@CesarBS I'm trying to get Parrallels proxying to work too reason I ask. I tried disabling IPv6 in that and no dice. It doesn't even respond when I try I would probably be safe to assume this would not work with docker proxying too? |
@amcdnl: You typically want to configure Kestrel to accept external requests when running inside a VM or container. URLs |
To summarize, there are two valid workarounds for nginx proxying to Kestrel in RC2:
|
@mikeharder Can you provide an example of the config to make it accept external requests? |
Accept external requests on both IPv4 and IPv6, port 5000: var host = new WebHostBuilder()
.UseUrls("http://+:5000")
.UseKestrel() |
@mikeharder Works...Thanks for your help! |
@mikeharder Thanks! |
@mikeharder shouldn't that be the default? |
@amcdnl Rejecting external requests by default and when "localhost" is specified was a design decision we made to make Kestrel more secure by default: aspnet/Announcements#80 I do think that Kestrel should bind to both the IPv4 and IPv6 loopback intervaces which is tracked by #231 and fixed by #870. |
I'm having the same problem with browser-sync and kestrel. Is there another workaround to try for this? |
I've used this with RC2 relase + BS 2.* |
@peterblazejewicz that doesn't work for me either, sorry. |
@erandros
I'm using |
@peterblazejewicz
(I'm not sure for the proxy) |
@okuz Are you trying to use RC2? We no longer support adding commands (like the "web" command) to the project.json.
I would see if you can get this sample running first: https://github.com/aspnet/cli-samples/tree/master/HelloMvc I would also make sure that everything is working without a proxy trying anything else like browser-sync. |
I checked again today, and browser-sync started working with Kestrel. |
When using Krestel with Browser-sync my requests never respond. If I launch IISExpress and proxy the requests it works.
Many others have had this issue too:
The text was updated successfully, but these errors were encountered: