Skip to content
This repository has been archived by the owner on Dec 18, 2018. It is now read-only.

No-cache does not seem to work for IE #848

Closed
moozzyk opened this issue Sep 11, 2017 · 16 comments
Closed

No-cache does not seem to work for IE #848

moozzyk opened this issue Sep 11, 2017 · 16 comments
Assignees

Comments

@moozzyk
Copy link
Contributor

moozzyk commented Sep 11, 2017

As per: 325c909#commitcomment-24230784

I'm using the latest version. I added all ts files in my project and compiled it to es5. I also tried to use the es5 files in the npm package but same result.

I created a repository with a subset of our project, with the fallback (I commented out to test the IE longpolling error). If you start the backend and frontend you'll see IE keep sending connection requests.

Other issue that if I enable my fallback method it still uses longpolling on Azure while it uses Websockets locally. Will deploy this example on Azure tomorrow.

https://github.com/Marcelh1983/signalr-example
signalR service: https://github.com/Marcelh1983/signalr-example/blob/master/Frontend/src/app/shared/services/signalr.service.ts

@moozzyk
Copy link
Contributor Author

moozzyk commented Sep 11, 2017

I will be changing the no-cache header to nonce for long polling and will test this scenario.

@moozzyk moozzyk self-assigned this Sep 11, 2017
@moozzyk
Copy link
Contributor Author

moozzyk commented Sep 12, 2017

@Marcelh1983 - I don't seem to be able to run this application. I think it fails on some kind of auth.

image

Can you create a trimmed version of the repro?

I also sent a PR to replace the Cache-Control header with nonce today and was able to run all the long polling tests on IE11, IE10 and IE9.

One thing that you may want to check is that IE did not cache your script - maybe IE is using an old script without No-Cache even though you have a fixed version in your repo because it loads it from the cache. You may want to disable caching and/or reload your page with Ctrl+F5.

@moozzyk
Copy link
Contributor Author

moozzyk commented Sep 12, 2017

My bad - I did not notice that the backend server was running on port 25602. Once I fixed I was able to run the sample in IE11 and Chrome and they communicated with each other just fine and IE did not cache xhr requests. I think you have a cached script somewhere.

image

@moozzyk
Copy link
Contributor Author

moozzyk commented Sep 12, 2017

Closing as no repro.

@moozzyk moozzyk closed this as completed Sep 12, 2017
@Marcelh1983
Copy link

Marcelh1983 commented Sep 12, 2017

Thanks for having a look. I still get the error but maybe it is related to something else. I now use the es5 javascript files from the npm package.

I deployed in here: http://signalr-core-example.azurewebsites.net
On Internet Explorer 11:
If I'm using long polling locally it keeps sending requests to the server immediately. On Azure it freezes for a while and after a while sending these authentication requests

ie-calls

@Marcelh1983
Copy link

Other thing, but maybe that's another issue is that it uses long polling on azure:

socketfail

Locally it connects using websockets

@moozzyk
Copy link
Contributor Author

moozzyk commented Sep 12, 2017

Can you use non-minimized version? It is easier to debug because the line number will point to the location of the error. I wonder if the issue is that the url does not start with ws:///wss://. Can you set a breakpoint on this line and see what the url is and if it does not contain the protocol (ws) what url was passed to the transport?

@moozzyk
Copy link
Contributor Author

moozzyk commented Sep 12, 2017

Websockets don't work because you pass relative URL:
image

I just merged a change where relative urls are resolved so you need to update the client or pass full url.

@Marcelh1983
Copy link

Thanks! Can you also reproduce the ie11 long polling error? Click on a icon and wait like 1 minute. Any idea what the problem could be?

@moozzyk
Copy link
Contributor Author

moozzyk commented Sep 12, 2017

I can see it. No idea yet what's causing it because IE hangs due to the tight loop.

@moozzyk
Copy link
Contributor Author

moozzyk commented Sep 12, 2017

It seems that you are using some kind of polyfill of XmlHttpRequest. I am not sure why you do this but it does not seem to set/send the Cache-Control header and IE is serving xhr from the cache:
image

I would recommend not using the polyfill - not sure why it is required. Also, I also merged a change this evening where we no longer rely on Cache-Control header to prevent IE from caching xhr requests. If you get this version this should fix the issue even if you use the polyfill.

@Marcelh1983
Copy link

Angular-cli provides all these polyfills which you should uncomment when you want internet explorer support. So maybe I should have looked in more detail to what I ucommented, but probably more people will do the same way as I do.

Thanks you so much for looking into my issues!

@Marcelh1983
Copy link

I just tested with your merged code. Everything locally works fine, IE and chrome. On Azure it connects using websockets. So all the issues I experienced are solved.

Only problem now is that the client doesn't receive any signalR events while it works locally. I don't see any errors. I tried things like changing relative url to full, removing IE polyfills, deploying the dev build instead of minified one, but nothing helps.

@davidfowl
Copy link
Member

@Marcelh1983 did you try turning logging on?

@Marcelh1983
Copy link

I set the logLevel on trace in the frontend.

Get the message that it is connected. But no info/errors when the events should coming in.
Information: WebSocket connected to wss://signalr-core-example.azurewebsites.net/assignmentHub?authorization=eyJ0eXAiOiJKV1...

Don't see any errors on the backend, and the backend isn't changed since the last version that worked,

@Marcelh1983
Copy link

Marcelh1983 commented Sep 12, 2017

Sorry probably something on my side though it is strange it worked before and I didn't change anything on the backend.

I send the events to the auth0-id which is stored in the User.Claims(). Somehow this is empty on azure. If I attach the debugger to Azure it works. Will try to find the problem.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants