I've long suffered a problem similar to the one described in #295246: An error occurred at /drupal/admin/build/views/ajax/preview/ but none of the suggestions in that thread helped (including changing theme, tweaking code, upgrading from 2.8 to dev, switching off a huge number of modules).
AFAIK, I was getting an error message, such as the one in the attached image, only when I clicked the Update button, not during other Ajax operations.
Finally the solution came when I switched off the Secure Pages module. But it is not a Secure Pages problem (see here) because even without that module, if I edit Views over https I am having the problem.
The problem is related to the secure connection. As you can see in the attached image, the Ajax link is insecure despite the fact that the views editor was opened over secure connection!
Comments
Comment #1
vacilando commentedI can confirm one more Ajax operation that did not work over https - namely click sorting. There was no error message and the view refreshed after click, but the sorting was incorrect or not changed at all. I thought it was an unrelated problem but now, testing things over http, click sorting works perfectly again.
Comment #2
Lloyd commentedI can confirm this as well. Had the error message with https but not http. Added exclusion to secure pages for admin/build/views/ and it seems to be fine now.
Comment #3
vacilando commented@Lloyd -- thanks for the confirmation.
And does column click sorting work for you over https? (See #1.)
Comment #4
Alan.Guggenheim commentedSame problem here. We secured our site recently, and now I cannot make any change to views and I am running into a similar error in messaging when typing names in the to field.
Comment #5
ferrallc commentedSame problem. I told Secure Pages to ignore
*/views/edit/*
and the error went away.
Comment #6
merlinofchaos commentedThis isn't a bug in Views. secure pages is making some of the site https and some of the site http and as far as javascript is concern, that makes it two different sites. AJAX calls can't be made crossdomain. Secure pages makes this fail.
Comment #7
vacilando commented@merlinofchaos - are you absolutely sure? As I said in my initial message: "[I]t is not a Secure Pages problem (see here) because even without that module, if I edit Views over https I am having the problem. The problem is related to the secure connection. As you can see in the attached image, the Ajax link is insecure despite the fact that the views editor was opened over secure connection!"
Comment #8
merlinofchaos commentedThe choice of http/https is made by Drupal in the url() function, not Views. Views does what Drupal demands of it. If you are making a secure connection in a way that Drupal doesn't tell Views what to do correctly, how is Views supposed to detect that?
Comment #9
neclimdulI'm curious if a) vacilando is using some sort of https proxy and b) views is using an absolute url for the ajax posts.
I have a feeling that Drupal's url function is not smart enough to parse the fact that the request is going through a proxy because as far the server running php is concerned its a non secured request.
(I ran into this problem and just exclude the views admin from secure pages.)
Comment #10
vacilando commented@neclimdul: no, not using proxy.
Exclusion surely is a solution but it would be good to solve the actual problem at some point.
Comment #11
thebuckst0p commentedPutting this line in settings.php fixes it (change mysite.com as needed):
$base_url = ((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS']=='on') ? 'https://' : 'http://') . 'mysite.com';Comment #12
gabidrg commented@thebuckst0p: Nice, worked for me! Using Secure Pages and having AJAX not working on submits in Views UI (Views 6.x-2.11)
Comment #13
vacilando commentedThat's elegant; thanks, thebuckst0p!