fix(prestashop): image edubox-prestashop fonctionne en local et derrière proxy
- 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
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
--- a/classes/shop/ShopUrl.php
|
||||
+++ b/classes/shop/ShopUrl.php
|
||||
@@ -175,15 +175,23 @@
|
||||
|
||||
public static function getMainShopDomain($id_shop = null)
|
||||
{
|
||||
- ShopUrl::cacheMainDomainForShop($id_shop);
|
||||
-
|
||||
- return self::$main_domain[(int) $id_shop] ?? null;
|
||||
+ // EduBox: dynamic public domain behind reverse proxy or direct local access.
|
||||
+ // Always use the request host instead of the domain stored in database.
|
||||
+ // Keep non-standard ports (e.g. localhost:8088) so local access works.
|
||||
+ $host = Tools::getHttpHost(false, false, false);
|
||||
+ if (substr($host, -3) === ':80' || substr($host, -4) === ':443') {
|
||||
+ $host = substr($host, 0, strrpos($host, ':'));
|
||||
+ }
|
||||
+ return $host;
|
||||
}
|
||||
|
||||
public static function getMainShopDomainSSL($id_shop = null)
|
||||
{
|
||||
- ShopUrl::cacheMainDomainForShop($id_shop);
|
||||
-
|
||||
- return self::$main_domain_ssl[(int) $id_shop] ?? null;
|
||||
+ // EduBox: dynamic public domain behind reverse proxy or direct local access.
|
||||
+ $host = Tools::getHttpHost(false, false, false);
|
||||
+ if (substr($host, -3) === ':80' || substr($host, -4) === ':443') {
|
||||
+ $host = substr($host, 0, strrpos($host, ':'));
|
||||
+ }
|
||||
+ return $host;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user