moby: Windows - eventsource type "long connections" are not working through NAT

Docker version 1.12.2-cs2-ws-beta, build 050b611

I am investigating an issue - I’m running ServiceStack inside a docker container with port mapping 80. My app uses server sent events to keep clients up to date with changes and it seems the “long” eventsource type connections are being closed by the docker NAT prematurely.

The reason why I think its a docker issue is because if I connect to the docker container directly (no nat) everything works. Its only when I connect through the virtual docker port this issue comes up.

For instance if my container is running at 172.18.91.192 which I started with -p 8080:80 - connecting to http://172.18.91.192/ from the host works. But when connected to http://[host]:8080 all eventsource type connections are closed immediately after the initial response.

I can provide any additional info requested or run tests - this is my current dockerfile

FROM microsoft/iis
ARG CONT_IMG_VER
ENV CONT_IMG_VER ${CONT_IMG_VER:-v1.0.0}

RUN powershell -Command \
	Add-WindowsFeature Web-Server; \
	Add-WindowsFeature Web-Net-Ext45; \
	Add-WindowsFeature Web-AppInit; \
	Add-WindowsFeature Web-Asp-Net45;

	
RUN powershell -Command Stop-WebAppPool -name DefaultAppPool
RUN powershell -Command Stop-WebSite -name 'Default Web Site'

COPY ./* C:/inetpub/wwwroot/bin/
COPY *.config C:/inetpub/wwwroot/
COPY *.asax C:/inetpub/wwwroot/
COPY *.cshtml C:/inetpub/wwwroot/
COPY *.css C:/inetpub/wwwroot/
COPY *.js C:/inetpub/wwwroot/

RUN powershell -Command \
	Import-Module WebAdministration; \
	Set-ItemProperty 'IIS:/Sites/Default Web Site' -name applicationDefaults.preloadEnabled -value True; \
	Set-ItemProperty 'IIS:/Sites/Default Web Site' -name serverAutoStart -value True; \
	Set-ItemProperty 'IIS:/AppPools/DefaultAppPool' -name autoStart -value True; \
	Set-ItemProperty 'IIS:/AppPools/DefaultAppPool' -name startMode -value 'alwaysrunning'; \
	Set-ItemProperty 'IIS:/AppPools/DefaultAppPool' -name managedRuntimeVersion -value 'v4.0'; 

RUN powershell -Command Start-WebAppPool -name DefaultAppPool
RUN powershell -Command Start-WebSite -name 'Default Web Site'

EXPOSE 80

CMD sc stop wuauserv
CMD netsh advfirewall set allprofiles state off

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 18 (6 by maintainers)

Most upvoted comments

@volak Browsers don’t understand the ~ prefix, but you could change it to /event-heartbeat?id=xxx but this only works when your ServiceStack Instance is hosted from root, e.g. chat.netcore.io not chat.netcore.io/api or at any other virtual path.

yeahh I was just thinking about that - the whole problem is the content of the heartbeatUrl being sent back no way for SS or docker to do anything about this.
Closing issue thanks a lot for your time @msabansal and @mythz

@volak looking at the traces i see a lot of streams disconnecting at 10,20 or 30 seconds (10 being very common). I would debug some more when i get cycles on this. Please expect an update in a day or two