Chrome data compression proxy error with jquery ajax form submission

旧巷老猫 提交于 2019-12-07 13:38:32

问题


I have a simple web page with a form that gets submitted via ajax using jquery. The form works fine when submitting it on a desktop browser, but the form gets an error when submitted using Chrome on a mobile device that has the "chrome data compression proxy" feature enabled.

I get the following error message:

This page cannot be loaded via the "chrome data compression proxy. Try reloading this page.

After doing a bit of searching around, there are a few "similar" questions like this one and more notably this one, but neither quite help me.

The seconds question is supposedly answered by the lead of the "Chrome data compression proxy" I've tried the suggestion in the second questions answer which is to set the Cache-Control header to no-transform. But that made no difference.

Has anyone had similar issues and have a work around for this?

This is the code I'm using to submit the form:

$.ajax({
    type : "POST",
    url : "services/users/changePasswordUsingToken",
    data : {
        'token' : token,
        'md5pwd' : md5pwd
    },
    headers : {
        'Cache-Control': 'no-transform'
    },
    success : function(response, textStatus, xhr) {
        ...
    },
    error : function(xhr, status, error) {
        alert(xhr.responseText); //This page cannot be loaded via the "chrome data compression proxy. Try reloading this page.
    ...
});

回答1:


I'm the tech lead for the Chrome compression proxy.

This error message is sent when the proxy can't access the site for some reason - e.g., a DNS resolution error, or if the site is not on the public Internet (e.g., an intranet). Normally, for GET requests the browser would be able to reload the URL automatically without using the proxy, but this is not possible with POST.

Can you provide some more details on where this site is hosted and whether it's behind a private network? I've seen a couple of reports of this and I'd like to come up with a general solution. Thanks.




回答2:


I had the same problem by accessing local server from mobile by machine name, like: http://scabbiaza.local:3000

Started using access by IP and got rid off this issue.



来源:https://stackoverflow.com/questions/24216646/chrome-data-compression-proxy-error-with-jquery-ajax-form-submission

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!