-
-
Notifications
You must be signed in to change notification settings - Fork 6.9k
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
Redirect problems in Internet Explorer 11 (IE11) #9670
Comments
Duplicates yiisoft/jquery-pjax#26 |
Added |
When this bug will be corrected? I have same problem with IE 10 till edge. If I make ajax request and page redirects to login with status code 302, IE throw "SCRIPT7002: XMLHttpRequest: Network Error 0x2f76, Could not complete the operation due to error 00002f76.". For now I will rewrite loginRequired function to redirect ajax requests with status code 308, but I hope this bug will be corrected soon. |
Related on SO: Related on GitHub: it seems, that it's not really an only Yii2-related problem |
Also I don't like 308 code for redirect, because according to the RFC it's a permanent redirect.
|
There is a good article on HabraHabr in Russian, where the author suggests to use 303 code. In the end of the post, there is a tip, that 303 doesn't work in old browsers, but the post was written almost 6 years ago. So I've tested IE11 with both 303 and 308 redirects: |
All SO posts are about Yii and you say it's not Yii problem? Sounds like a joke. Especially when yii.js handles redirects. And yes 303 code is not a solution. |
I said that it's not a Yii problem since you can easily reproduce it with plain PHP and AJAX. The root of the problem is Since the problem affects all the IE versions (including modern) I think that we should try fix it somehow. @yiisoft/core-developers do you have any ideas? |
We could probably detect IE and send another header for it. |
I'm not happy with the idea of detecting browser versions in the core code =/ |
Well, yes but I see no other choice right now. |
@yiisoft/core-developers nobody else have a better idea? Or nobody complains about adding such check to the |
May be pjax can add custom header for problem browsers and yii will detect it? |
And we should have an option in it to disable this new behavior |
@AnatolyRugalev that's a better idea! |
Please, check out #10483 and yiisoft/jquery-pjax#38 |
Bug #9670: Fixed PJAX redirect in IE
So, it's only corrected for PJAX. What about regular ajax redirect (handled in other browsers with yii.js RedirectHandler)? In IE it's still not working. |
The problem is still persists for regular ajax redirects in IE & Edge, because HTTP request does not contain header "X-Ie-Redirect-Compatibility" so redirect does not work properly. |
I agree with @Fr1ar . |
How to fix this issue? I am getting the same error trying to post json data to controller/action from Javascript using $.ajax. Works well in other browsers.. having issue in IE11. $.ajax({ |
Issue is still ongoing, tested with IE11 and Yii 2.0.12, even latest (to this date) Yii 2.0.22 - has the same issue. |
Please report issue separately. Thanks. |
When I use the included IE debugger and view the response headers, the header is there and the url is correct, but IE11 isn't reading it.
The response error:
The response headers:
One comment on StackOverflow suggested using the status code
200
, and after testing, this does appear to work. I know the default redirect status code is 302, but this just doesn't work.Update
I just respond with redirect to ajax request. Page redirects in all browsers except IE. I'm testting in IE11. I'm getting the following error in console: XMLHttpRequest: Network Error 0x2f76, Could not complete the operation due to error 00002f76..
URL for redirect sent in X-Redirect header. yii.js script handles this header, see line 265. var url = xhr.getResponseHeader('X-Redirect');. In case of IE11 getResponseHeader() returns null instead of URL. As I mentioned before I just respond with 200 status at the moment instead of 302.
The text was updated successfully, but these errors were encountered: