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?

Share this post


Link to post
Share on other sites

Yes I am sure I'm using the correct IP, I entered the one I got from ipconfig in cmd prompt and also the one I got from http://myip.dk/, seperated with commas, none of which seem to work. 

Share this post


Link to post
Share on other sites

Which presta version do you use? Tried maintenance IP on 1.5.6.1 and it works just fine.

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

It should be your IP, not the server's. Do you use your own server?

Share this post


Link to post
Share on other sites

90.185.47.***

 

you use this ip? or something different? i masked last part due your privacy ;) 

Share this post


Link to post
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?

Share this post


Link to post
Share on other sites

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?!?

Share this post


Link to post
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.

 

Share this post


Link to post
Share on other sites

 

Hi.

 

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

 

 

It worked, thanks a lot.

Share this post


Link to post
Share on other sites

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 ?

Share this post


Link to post
Share on other sites

×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More