PrestaShop与Cloudflare CDN使用SSL导致的后台不断退出的问题

prestashop如果使用cloudflare CDN并且开启了SSL就会导致后台无法进入,即使登陆成功后点击任何功能也会退出。

这是由于如果服务器上没有安装mod_cloudflare模块,那么服务器的IP就是Cloudflare的反向代理IP,这个IP可能会在每次重新加载页面时发生变化!所以Prestashop系统检测到新IP会强制重新登陆。

解决方法

Prestashop早期的版本中,后台有个设置是"Check the cookie’s IP address",只需要禁用该选项就可以。

但是我所使用的最新8.01版本中没有找到该选项,所以只能在服务器上安装mod_cloudflare模块来解决这个问题。

安装mod_cloudflare

准备apxs2

安装该模块需要使用apxs2来完成,服务器上如果没有安装apache2-dev,则需要先安装一下

sudo apt-get install apache2-dev

开始安装

mod_cloudflare github官网有具体说明:https://github.com/cloudflare/mod_cloudflare

在下载文件mod_cloudflare.c之后,运行

apxs2 -a -i -c mod_cloudflare.c

最后重启apache

systemctl restart apache2

最后检查一下模块是否成功安装

apache2ctl -M 
Loaded Modules:
 core_module (static)
 so_module (static)
 watchdog_module (static)
 http_module (static)
 log_config_module (static)
 logio_module (static)
 version_module (static)
 unixd_module (static)
 access_compat_module (shared)
 alias_module (shared)
 auth_basic_module (shared)
 authn_core_module (shared)
 authn_file_module (shared)
 authz_core_module (shared)
 authz_host_module (shared)
 authz_user_module (shared)
 autoindex_module (shared)
 cloudflare_module (shared)    #安装成功
 deflate_module (shared)
 dir_module (shared)
 env_module (shared)
 filter_module (shared)
 mime_module (shared)
 mpm_prefork_module (shared)
 negotiation_module (shared)
 php_module (shared)
 reqtimeout_module (shared)
 rewrite_module (shared)
 setenvif_module (shared)
 socache_shmcb_module (shared)
 ssl_module (shared)
 status_module (shared)

Post Comment