slimphp / Slim-Views

Slim Framework 2 custom views

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

siteUrl does not work with HTTPS

Rudloff opened this issue · comments

I am using siteUrl in Smarty templates on an HTTPS website and it generates HTTP URLs. It should generate HTTPS URLs.

From what I can remember siteUrl generates relative links so it shouldn't make a difference if your server is configured correctly.

I'm pretty sure it generates absolute URLs.
For example, {siteUrl url='dist/main.css'} gives me http://localhost/alltube/dist/main.css.

ok just add withUri="false" to the smarty tag and you should get relative urls.

https://github.com/slimphp/Slim-Views/blob/master/SmartyPlugins/function.siteUrl.php#L15

I tried {siteUrl url='dist/main.css' withUri=false} but it gives me this URL: http://localhost/dist/main.css

At this point I am going to suggest not using siteUrl or creating your own without using Slim Request getUrl method. I think the getUrl method is doing absolute urls.

It seems my server is not correctly setting $_SERVER['HTTPS'] to true, so Slim getUrl method could not properly detect SSL...