Skip to content
This repository has been archived by the owner on Mar 17, 2020. It is now read-only.

Fix Mixed content problem on shops with SSL #9

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from

Conversation

rjcorflo
Copy link

When SSL is activated on all pages of the shop, ajax GET requests are being redirected.

This happpens on default FrontController.php on line 785 (Prestashop 1.6), in the method:

    /**
     * Redirects to correct protocol if settings and request methods don't match.
     */
    protected function sslRedirection()
    {
        // If we call a SSL controller without SSL or a non SSL controller with SSL, we redirect with the right protocol
        if (Configuration::get('PS_SSL_ENABLED') && $_SERVER['REQUEST_METHOD'] != 'POST' && $this->ssl != Tools::usingSecureMode()) {
    ...
    }

The condition is true and there is an HTTP redirection, what cause the mixed content problem on new browsers.

Can anyone reproduce this problem? Could be happening on other ajax GET requests.

When SSL is activated on all pages oh the shop, ajax GET request are being redirected. This happpens on default FrontController.php on line 785. In this method:
    /**
     * Redirects to correct protocol if settings and request methods don't match.
     */
    protected function sslRedirection()
    {
        // If we call a SSL controller without SSL or a non SSL controller with SSL, we redirect with the right protocol
        if (Configuration::get('PS_SSL_ENABLED') && $_SERVER['REQUEST_METHOD'] != 'POST' && $this->ssl != Tools::usingSecureMode()) {
            $this->context->cookie->disallowWriting();
            header('HTTP/1.1 301 Moved Permanently');
            header('Cache-Control: no-cache');
            if ($this->ssl) {
                header('Location: '.Tools::getShopDomainSsl(true).$_SERVER['REQUEST_URI']);
            } else {
                header('Location: '.Tools::getShopDomain(true).$_SERVER['REQUEST_URI']);
            }
            exit();
        }
    }

    The condition is true and there is a HTTP redirection.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant