Php photo gallery TWG | JFUploader | TWG Flash upload | WFU | Forum
https://www.tinywebgallery.com/forum/

add_iframe_url_as_param_prefix broken in https --> Solved
https://www.tinywebgallery.com/forum/viewtopic.php?f=21&t=4365
Page 1 of 1

Author:  marcverkade [ 28. Jun 2017, 06:59 ]
Post subject:  add_iframe_url_as_param_prefix broken in https --> Solved

Hai Michael,

Something strange is happening regarding parameter forwarding in https.
I use this shortcode to redirect the URL parameter '?page=' to the website's iFrame:

[advanced_iframe securitykey="mykey" use_shortcode_attributes_only="true" src="https://webshop-wordpress.broekmans.nl" width="100%" height="2000" scrolling="no" enable_ios_mobile_scrolling="true" id="EVWebshop" name="EVWebshop" url_forward_parameter="ALL" add_iframe_url_as_param_prefix="https://webshop-wordpress.broekmans.nl" onload_scroll_top="true" show_iframe_loader="true" enable_responsive_iframe="true" hide_page_until_loaded="false" resize_on_ajax_jquery="false" enable_external_height_workaround="true" map_parameter_to_url="page" use_post_message="true" ]

When using this shortcode with http, the URL 'http://broekmans.nl/webshop/?page=/assortiment/choco-presentje' would direct the iFrame in the page to the corresponding page: http://webshop-wordpress.broekmans.nl/assortiment/choco-presentje and worked correct and perfect. This URL shows a working site still running in http: http://www.bakkerijpot.nl/webshop/?page=/assortiment/vlaaien/appel-vlaai-27-cm-10-personen

Since a few days the site is running in https, so I changed the shortcode accordingly (added the -s and https://), but somehow the URL 'https://broekmans.nl/webshop/?page=/assortiment/choco-presentje' does not show the page in the iFrame but shows the message: Http iframes are not shown in https pages in many major browsers. Please read this post for details.. You can see it yourself by clicking the link.

But I do nothing with http, only https... Any clue why this message appears and how I can fix the parameter forward in https?

Regards, Marc

Author:  marcverkade [ 28. Jun 2017, 07:06 ]
Post subject:  Re: add_iframe_url_as_param_prefix not working in https

I see this in the frame source: src='http://https://webshop-wordpress.broekmans.nl/assortiment/choco-presentje'
So something goes wrong when adding the parameter to the URL...
I guess you now have a clue what goes wrong ;-)

Author:  marcverkade [ 28. Jun 2017, 07:30 ]
Post subject:  Re: add_iframe_url_as_param_prefix not working in https

Hai Michael,

I made a nasty workaround and removed the 'https://' i had added earlier to the shortcode parameter 'add_iframe_url_as_param_prefix' when it failed.
It now works but this is not a real solution I guess... So if you have a better solution, I really want to know.

BTW... No clue what I am doing, I am an ASP.Net guy ;-)

Changed http:// in https:// in the file advanced-iframe-main-prepare.php

Old code
if (!$this->ai_startsWith($src,"http")) {
if ($this->ai_startsWith($src,"s|")) {
$src = "https://" . $prefix . substr($src,2);
} else {
$src = "http://" . $prefix . $src;
}
}
New code
if (!$this->ai_startsWith($src,"http")) {
if ($this->ai_startsWith($src,"s|")) {
$src = "https://" . $prefix . substr($src,2);
} else {
$src = "https://" . $prefix . $src;
}
}

And in the file advanced-iframe-main-helper.php I replaced http:// with https:// too
$location = (@$_SERVER["HTTPS"] == "on") ? "https://" : "https://";

Regards, Marc

Author:  marcverkade [ 28. Jun 2017, 07:42 ]
Post subject:  Re: add_iframe_url_as_param_prefix not working in https

Hmmm, does tis mean that I have to prefix the url with 's|'?
Let's wait what you have to say ;-)

Author:  TinyWebGallery [ 29. Jun 2017, 13:40 ]
Post subject:  Re: add_iframe_url_as_param_prefix not working in https

$location = (@$_SERVER["HTTPS"] == "on") ? "https://" : "https://";

should not be needed. What does your server return at $_SERVER["HTTPS"] ?

But I don't understand why your change should help! Because you only get to this part IF your url does NOT start with http

add_iframe_url_as_param_prefix="https://webshop-wordpress.broekmans.nl" is wrong! Please check the documentation:
With this setting you can define a prefix which all (most) of your pages in the iframe have. This prefix is than not added to the url but added internally. This does reduce the length of the parameter value. The prefix has to be without http:// or https://. So a prefix could be www.tinywebgallery.com/examples/.

Best, Michael

Author:  TinyWebGallery [ 29. Jun 2017, 13:43 ]
Post subject:  Re: add_iframe_url_as_param_prefix not working in https

Maybe $_SERVER["HTTPS"] is the problem if your server does not set this to on but to a different value!

But this is only used if you use {href} in your code which is not the case...

and s| is something internal I use to keep the parameter short.

Best, Michael

Author:  marcverkade [ 2. Jul 2017, 22:18 ]
Post subject:  Re: add_iframe_url_as_param_prefix not working in https

Hai Michael,

You have misread my message:

Try 1: I replaced all http with https but left param_prefex to 'add_iframe_url_as_param_prefix="webshop-wordpress.broekmans.nl"'
Then the message: 'Http iframes are not shown in https pages in many major browsers. Please read this post for details' appeared

Try 2: I replaced the param_prefex to 'add_iframe_url_as_param_prefix="https://webshop-wordpress.broekmans.nl"'
Then nothing worked...

Try 3: I replaced the param_prefex to 'add_iframe_url_as_param_prefix="webshop-wordpress.broekmans.nl"'
And changed the code advanced-iframe-main-prepare.php with the workaround replcing http with https...

So any clue why Try 1 and Try 2 failed?
Regards, Marc

Author:  TinyWebGallery [ 3. Jul 2017, 22:32 ]
Post subject:  Re: add_iframe_url_as_param_prefix not working in https

I think $location = (@$_SERVER["HTTPS"] == "on") ? "https://" : "https://"; does not change anything....

Try 2 does not make sense but at try 1 I think your fix is adding the right "s" but I need to find out why it is not there as the other part with the s| should be used. I need to setup this scenario.....

Best, Michael

Author:  TinyWebGallery [ 3. Jul 2017, 23:38 ]
Post subject:  Re: add_iframe_url_as_param_prefix not working in https

I think I know.

are you using old bookmarks like:
https://broekmans.nl/webshop/?page=/assortiment/choco-presentje%27 ?

Because for https the link should be
https://broekmans.nl/webshop/?page=s|/assortiment/choco-presentje%27

the s| I normally add by javascript. So if you need your old bookmarks working then
$src = "http://" . $prefix . $src;
->
$src = "https://" . $prefix . $src;

Is the way to go...

Best, Michael

Author:  TinyWebGallery [ 4. Jul 2017, 13:13 ]
Post subject:  Re: add_iframe_url_as_param_prefix not working in https

for the next version I add an improvement here. If no s| is present I check the original iframe url if set. The one that is loaded when no page parameter does exist. And is this is https I do https - otherwise http then.

Best, Michael

Author:  marcverkade [ 9. Jul 2017, 01:52 ]
Post subject:  Re: add_iframe_url_as_param_prefix not working in https

That would be great...
IMHO it always should check if the base-url of the iFrame is https and set it accordingly...
I'll await the update and until then, make the dirty hack for every new site.
Regards, Marc

Author:  TinyWebGallery [ 9. Jul 2017, 23:05 ]
Post subject:  Re: add_iframe_url_as_param_prefix not working in https

Actually there is no dirty hack! You changed the protocol but you did not changed the links (added the s|).
My update is only a fallback because inside the iframe also a switch from http to https can happen.

:).

Best, Michael

Page 1 of 1 All times are UTC + 1 hour [ DST ]
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/