We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

custom plug-in problem: fetch_current_uri doesn't get HTTPS

Development and Programming

susansan's avatar
susansan
75 posts
13 years ago
susansan's avatar susansan

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

       
Focus Lab Dev Team's avatar
Focus Lab Dev Team
1,129 posts
13 years ago
Focus Lab Dev Team's avatar Focus Lab Dev Team

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

       
susansan's avatar
susansan
75 posts
13 years ago
susansan's avatar susansan

Thank you very much, Erik 😊 I will definitely check it out.

       

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.