I have a custom plug-in that uses a self-submitting form over SSL. Here’s a snippet the $form_details array to show you what I have set for the “action” param:
$form_details = array('action'=> $this->EE->functions->fetch_current_uri(),However, even though my current URI is secure (https://mysite.com/something), the fetch_current_uri() function returns it without the “s”. For now, I’ve implemented the following workaround:
$form_details = array('action'=> str_replace("http:", "https:", $this->EE->functions->fetch_current_uri()),Any ideas on why fetch_current_ur() won’t pull the secure version of the URL? Or, is there a better way for me to do this?
Thanks, Susan
Hi Susan,
That method uses a config setting from within your site. If your site has the “site_url” setting without the “s” then that’s how the URL will be processed.
At Focus Lab we use a dynamic config setting to respect the current protocol, http vs https. You can read a little about this approach in a few places:
http://eeinsider.com/articles/multi-server-setup-for-ee-2/ https://github.com/focuslabllc/ee-master-config
Erik
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.