Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2014-10-01 05:03:40

jstubbs
Member
From: Hong Kong
Registered: 2004-12-13
Posts: 2,395
Website

site_url and https

Wondering if it might be possible to have the <txp:site_url /> tag produce a secure link i.e https://domain.com instead of http://domain.com? In my case I’d like to guide a user to a secure data submission page via a menu. I think rah_replace could be used for this, but something native like <txp:site_url scheme="https" /> would be awesome.

Offline

#2 2014-10-01 09:02:22

gaekwad
Server grease monkey
From: People's Republic of Cornwall
Registered: 2005-11-19
Posts: 4,269
GitHub

Offline

#3 2014-10-01 23:57:14

tye
Member
From: Pottsville, NSW
Registered: 2005-07-06
Posts: 859
Website

Re: site_url and https

+1 & maybe an option for www or non www too…. maybe as a global preference???

Offline

#4 2015-04-11 06:38:30

jstubbs
Member
From: Hong Kong
Registered: 2004-12-13
Posts: 2,395
Website

Re: site_url and https

Bumping this – any chance this could become a reality soon?

Offline

#5 2015-04-11 07:17:18

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,091
Website GitHub Mastodon Twitter

Re: site_url and https

It would also be nice to have the option for the admin side too


Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

#6 2015-04-11 08:38:34

philwareham
Core designer
From: Haslemere, Surrey, UK
Registered: 2009-06-11
Posts: 3,564
Website GitHub Mastodon

Re: site_url and https

Sounds fair, maybe open a github issue for this?

Offline

#7 2015-04-11 09:28:18

jstubbs
Member
From: Hong Kong
Registered: 2004-12-13
Posts: 2,395
Website

Re: site_url and https

Thanks Phil, just opened a new issue.

Offline

#8 2015-06-04 16:47:40

makss
Plugin Author
From: Ukraine
Registered: 2008-10-21
Posts: 355
Website

Re: site_url and https

I use this scheme: web_users —> nginx:443(SSL) —> apache:80(textpattern)

nginx(if needed) set header HTTPS = on, but apache(textpattern) see it as HTTP_HTTPS = on so can not determine the https protocol.

Fast fix(for me) add in config.php line

if( empty($_SERVER['HTTPS']) && !empty($_SERVER['HTTP_HTTPS'])  ){ $_SERVER['HTTPS'] = $_SERVER['HTTP_HTTPS']; }

My site can be https/http requests, so I can not hard-code https protocol.


aks_cron : Cron inside Textpattern | aks_article : extended article_custom tag
aks_cache : cache for TxP | aks_dragdrop : Drag&Drop categories (article, link, image, file)

Offline

#9 2015-06-05 05:33:37

makss
Plugin Author
From: Ukraine
Registered: 2008-10-21
Posts: 355
Website

Re: site_url and https

I looked how https detected in other applications, for example, in phpMyAdmin.

if (PMA_getenv('HTTP_SCHEME')) {
	$url['scheme'] = PMA_getenv('HTTP_SCHEME');
} elseif (PMA_getenv('HTTPS') && strtolower(PMA_getenv('HTTPS')) == 'on') {
	$url['scheme'] = 'https';
// A10 Networks load balancer:
} elseif (PMA_getenv('HTTP_HTTPS_FROM_LB') && strtolower(PMA_getenv('HTTP_HTTPS_FROM_LB')) == 'on') {
	$url['scheme'] = 'https';
} elseif (PMA_getenv('HTTP_X_FORWARDED_PROTO')) {
	$url['scheme'] = /*overload*/mb_strtolower(PMA_getenv('HTTP_X_FORWARDED_PROTO'));
} elseif (PMA_getenv('HTTP_FRONT_END_HTTPS') && strtolower(PMA_getenv('HTTP_FRONT_END_HTTPS')) == 'on') {
	$url['scheme'] = 'https';
} else {
	$url['scheme'] = 'http';
}

phpMyAdmin is often used by SSL connection and this code has already been tested by many people.
Maybe that tells us how to solve the problem more correctly.

Last edited by makss (2015-06-05 05:34:50)


aks_cron : Cron inside Textpattern | aks_article : extended article_custom tag
aks_cache : cache for TxP | aks_dragdrop : Drag&Drop categories (article, link, image, file)

Offline

Board footer

Powered by FluxBB