I have set up 2 apache servers, one for 80 port and second for 443 HTTPS. The same domain is accessible via http://www.domain.com and https://www.domain.com. HTTPS seems to work fine, if I access the web by using a browser, page loads fine.
I have script http://www.domain.com/ajax.php which works fine on both 80 and 443, when accessed by browser (Chrome, FF, IE, ..), but in my page I use Jquery for POST ajax queries. When I do following, nothing happens, in Developer Tools in Chrome I just see, that the request is “pending” and no output from the server whatsoever.
$.post('https://www.domain.com/ajax.php?action=test', {}, function() {});
Could there be an issue, that the page making request is on HTTP connection and the ajax request uses HTTPS ? Or is there some other reason for this strange behaviour ? Also strange is, that regular page loads fine, e.g. https://www.domain.com/ – no problem. The problem with pending requests appears only with AJAX calls.
EDIT:
I don’t know if it is any important, but here is output from error_log of this Apache2-SSL server when one AJAX call was made:
[Thu May 19 21:05:30 2011] [info] [client 84.16.x.x] Connection to child 0 established (server www.domain.com:443)
[Thu May 19 21:05:30 2011] [info] Seeding PRNG with 144 bytes of entropy
[Thu May 19 21:05:30 2011] [info] [client 84.16.x.x] (70014)End of file found: SSL handshake interrupted by system [Hint: Stop button pressed in browser?!]
[Thu May 19 21:05:30 2011] [info] [client 84.16.x.x] Connection closed to child 0 with abortive shutdown (server www.domain.com:443)
Making a post request from a
httppage to ahttpspage will unfortunately result in (sort of) a cross-domain error. It will as you saw end with nothing. The workaround is to use JSON to fetch your data from yourhttppage to yourhttpspage. Read this article and you’ll be able to fix it. Good luck man!Other links you might need:
Jquery API – JSON
Cross domain requests (scroll down for JSON)