Hi there,
I would like to have my site both accessible with http and https. It seems that based on the "Site" -> "Server type" setting it’s either or. Is it not possible to have the links within the site (base href) protocol independent (so if a user connects with http the links are http - and https if he comes along with https).
Or is there another possibility to achieve this?
Thanks
Ki
-
MODX Staff
- 10,725 Posts
By default, the site will be accessible from both, according to your web server configuration details. I’m not sure the server type does anything anymore, but I could be mistaken.
Hi there,
Therebechips, thanks for the information.
Is it possible to change the behavior in general how the variable site_url is built (for [tt]<base href="[(site_url)]" />[/tt])?
And/or is it vise to delete the [tt]base href[/tt]-Tag from the template completely?
What I like is that from the users perspective MODx does not change from http to https (or vice versa). So if the user connects with http the links point to http, and if he comes along with https he stays on that.
Best regards,
Ki
-
MODX Staff
- 10,725 Posts
As long as you don’t cache the site_url in the base href tag, they should remain on the URL scheme they made the request with. It is not advisable to remove the base tag, as anyone who visits the site with a subfolder will likely not be able to find the CSS or other items linked by relative path from the root of the site (since MODx handles all virtual requests as if they were from the root).
Hi OpenGeek
Works like a charme! Thanks a lot.
Ki
Hi there,
I just made a fresh installation of MODx 1.0.2 on Ubuntu 2008.10 Server - and this snippet doesn’t work anymore... :-(
The hostname is returned correctly, but solely with http. I tried $_SERVER[’SERVER_PORT’], $_SERVER["HTTPS"] and even [(server_protocol)] in the template itself. Always with the same result.
According the apache access logs, Firefox and a network capture the connection is made with https.
Has this been changed in any way since MODx 1.0.0.? What could this be?
Thanks in advance
Ki