Jump to content

Recommended Posts

Hi, I'm having a problem with my Prestashop. When I add my IP, in the Maintenance IP on Preferences > Maintance page of Back Office, I'm still not able to access my webpage, it just shows my maintenance  message page.

Anyone know what might be the problem?

Link to comment
Share on other sites

1.5.6.1 is the one we're using. If I add the IP of the server (That's the one it adds when I press add my IP) everyone can see the website, I tried it from 2 different computers atleast. If I use the other IP's noone has access... It's very annoying.

Link to comment
Share on other sites

I have the same problem.

 

When I use my IP found on http://myip.dk/ I cannot access the frontoffice, however, if I click the Ad my IP from inside the maintenance module, I get a completely different IP, and then I can access my front office, but strangely enough, everybody can!

 

I use meebox too.

 

Any solotion?

Link to comment
Share on other sites

  • 3 months later...

Same problem here on two different sites (same host). Both sites are PS 1.6.0.6 (had same issue before upgrading from PS1.5).

Both shops are on Meebox (Denmark).

 

Add my IP gives me the domains IP which grants access to everybody . Adding my actual computer IP does not grant access.

 

Any ideas?!?

Link to comment
Share on other sites

Hi.

 

Replacing this function in classes/Tools.php worked for me

 

    /**
    * Get the server variable REMOTE_ADDR, or the first ip of HTTP_X_FORWARDED_FOR (when using proxy)
    *
    * @return string $remote_addr ip of client
    */
    static function getRemoteAddr()
    {
        // This condition is necessary when using CDN, don't remove it.
        if (isset($_SERVER['HTTP_X_FORWARDED_FOR']) AND $_SERVER['HTTP_X_FORWARDED_FOR'] AND (!isset($_SERVER['REMOTE_ADDR']) OR preg_match('/^127\..*/i', trim($_SERVER['REMOTE_ADDR'])) OR preg_match('/^172\.16.*/i', trim($_SERVER['REMOTE_ADDR'])) OR preg_match('/^192\.168\.*/i', trim($_SERVER['REMOTE_ADDR'])) OR preg_match('/^10\..*/i', trim($_SERVER['REMOTE_ADDR']))))
        {
            if (strpos($_SERVER['HTTP_X_FORWARDED_FOR'], ','))
            {
                $ips = explode(',', $_SERVER['HTTP_X_FORWARDED_FOR']);
                return $ips[0];
            }
            else
                return $_SERVER['HTTP_X_FORWARDED_FOR'];
        }
        return $_SERVER['REMOTE_ADDR'];
    }

 

With this one

 

    /**
    * Get the server variable REMOTE_ADDR, or the first ip of HTTP_X_FORWARDED_FOR (when using proxy)
    *
    * @return string $remote_addr ip of client
    */
    static function getRemoteAddr()
    {
        // This condition is necessary when using CDN, don't remove it.
        if (isset($_SERVER['HTTP_X_FORWARDED_FOR']) AND $_SERVER['HTTP_X_FORWARDED_FOR'])
        {
            if (strpos($_SERVER['HTTP_X_FORWARDED_FOR'], ','))
            {
                $ips = explode(',', $_SERVER['HTTP_X_FORWARDED_FOR']);
                return $ips[0];
            }
            else
                return $_SERVER['HTTP_X_FORWARDED_FOR'];
        }
        return $_SERVER['REMOTE_ADDR'];
    }
 

Good luck. 

 

 

Keep the original somewhere so you have it if it doesn't work, so you can revert the changes.

 

Link to comment
Share on other sites

  • 4 months later...
  • 11 months later...
  • 7 months later...
  • 2 months later...

I have a similar problem, 

 

I use Proxy (Varnish) and i can not set my eshop at maintance mode as all users are seen as local 127.0.0.1. 

 

What shall i change in order to get the real ip of clients and have the maintance fuction to work ?

Link to comment
Share on other sites

×
×
  • Create New...