Having an interesting problem, which I'm thinking is related to some internal security feature regarding the invoking of admin pages. A site I'm working on can have two different incoming URL's. If one, a certain banner should be used, if another, then another. The initial problem was that there's a cart, and certain pages are SSL, and the securepages module can't handle two possible SSL URL's. There's a SSL certificate for both. But when switching to https:, the correct one needs to be requested, otherwise the browser reports a problem with the certificate. So, the way I handled it was to hook_init before securepages becomes involved, and check the requested URL, and if it's the second, I simply overwrite securepage's variable entry with a variable_set with the new url. Works like a charm. Except... admin. I have securepages set to work with admin as well, but when I request an admin page, the logic in hook_init that should variable_set the url back to the normal domain doesn't seem to fire, because I'll have put http://mydomain.com/admin and it will invoke https://mydomain.com/admin but the variable setting will still be https://myotherdomain.com, so I get the certificate message.
In doing more testing...it seems that at the point where I process the url, in hook_init, it's already too late? I get the message (it's happening in IE all the time, not just admin), but if I reload, it's fine, which tells me that when the variable_set is done the first time through, it's already too late, and it's picked up the next time through. Is there something else I should be hooking instead of init?
On Nov 19, 2009, at 10:39 PM, Jeff Greenberg wrote:
So, the way I handled it was to hook_init before securepages becomes involved, and check the requested URL, and if it's the second, I simply overwrite securepage's variable entry with a variable_set with the new url. Works like a charm.
I know you solved your problem, but this is a race condition and will cause problems under load. The variable_set function alters the database, which won't just affect the current process. Instead, put the into directly into global $conf; which is where variable_get reads from. - Ken Winters
participants (2)
-
Jeff Greenberg -
Ken Winters