73b561ed33
- edubox-tools.patch : getShopDomain/Ssl conservent les ports non standards - edubox-configuration.patch : PS_SHOP_DOMAIN, _PS_BASE_URL_, PS_SSL_ENABLED… résolus dynamiquement - edubox-shop-getbaseurl.patch : Shop::getBaseURL() utilise le host de la requête - edubox-shopurl.patch : getMainShopDomain conserve les ports non standards - edubox-clear-cache-init.sh : vidage des caches à chaque démarrage - seed.ts : passage au tag 9-edubox-9 - README mis à jour avec les nouveaux patches
30 lines
1.1 KiB
Diff
30 lines
1.1 KiB
Diff
--- a/classes/shop/Shop.php
|
|
+++ b/classes/shop/Shop.php
|
|
@@ -489,15 +489,16 @@ class ShopCore extends ObjectModel
|
|
*/
|
|
public function getBaseURL($auto_secure_mode = true, $add_base_uri = true)
|
|
{
|
|
- if ($auto_secure_mode && Tools::usingSecureMode()) {
|
|
- if (!$this->domain_ssl) {
|
|
- return false;
|
|
- }
|
|
- $url = 'https://' . $this->domain_ssl;
|
|
+ // EduBox: use the current request host so local access on non-standard
|
|
+ // ports (e.g. localhost:8088) and reverse-proxy domains both work.
|
|
+ $host = Tools::getHttpHost(false, false, false);
|
|
+ if (substr($host, -3) === ':80' || substr($host, -4) === ':443') {
|
|
+ $host = substr($host, 0, strrpos($host, ':'));
|
|
+ }
|
|
+
|
|
+ if ($auto_secure_mode && Tools::usingSecureMode()) {
|
|
+ $url = 'https://' . $host;
|
|
} else {
|
|
- if (!$this->domain) {
|
|
- return false;
|
|
- }
|
|
- $url = 'http://' . $this->domain;
|
|
+ $url = 'http://' . $host;
|
|
}
|
|
|
|
if ($add_base_uri) {
|