我的网站“共享”缓存,但仅在公司网络上

时间:2018-07-03 18:53:52

标签: php apache cakephp

问题

  • 我们有一个运行在Google Cloud(CentOS 7)上且带有Apache的网站,该网站在我们的网络之外似乎运行良好,但是当公司内部的某人尝试访问/登录时,该网站显示了另一个工人帐户登录后,有时我们可以访问以前无法访问的某些产品,从这里开始,事情变得更加奇怪,当我们从站点发出一些请求时,它将保存日志,而当我们检查时,该请求是您首先登录的用户。

  • 每当我们强制刷新(在Google Chrome上为Ctrl + F5)时,问题似乎都会“修复”,直到另一个用户从我们的网络登录为止。

  • 该问题也发生在其他导航器上。

  • 该系统不是我开发的,它有点旧,但是以前从未有过这种行为。

伙计,我将逐步发布一些图像,以澄清正在发生的事情和一些代码行。

屏幕截图

First, I logged in with this user - Marcelo Correia

When I changed the page, instantly it has changed to my user (This part usually are another user that recently was logged in from our network

Here I made a request from the number that I have to censor: 108. Note that in the top of the page, there is still my user: Nelson Rodrigues

And finally when I check the log, inform that the request was really made by the user I was logged: Marcelo Correia, but somehow is still Nelson Rodrigues on the top and in the field "Nome Usuário"(Username) is set Nelson Rodrigues too.

我们的环境

  • 主机:Google Cloud
  • 服务器:CentOS 7
  • 蛋糕PHP 2.6.0
  • Javascript / JQuery

代码/某些配置

我们的导航栏

  <ul class="nav navbar-nav navbar-right m-n hidden-xs nav-user user">

    <li class="dropdown">
      <a href="#" class="dropdown-toggle" data-toggle="dropdown">
        <!--span class="thumb-sm avatar pull-left">
            <?php echo $this->Html->image('user.png');?>
        </spanaaa-->
        <?php echo $this->Session->read('Auth.User.nome')?> <b class="caret"></b>
      </a>
      <ul class="dropdown-menu animated fadeInRight">

蛋糕正在按会话吸引用户,但登录后,我确定名称正确-> Marcelo Correia

我们正在使用基于文件的文件来存储缓存。

$engine = 'File';
$duration = '+999 days';
if (Configure::read('debug') > 0) {
$duration = '+10 seconds';
}

/**
 * Configure the cache used for general framework caching. Path information,
 * object listings, and translation cache files are stored with this configuration.
 */
Cache::config('_cake_core_', array(
    'engine' => $engine,
    'prefix' => $prefix . 'cake_core_',
    'path' => CACHE . 'persistent' . DS,
    'serialize' => ($engine === 'File'),
    'duration' => $duration
));


/**
 * Configure the cache for model and datasource caches. This cache configuration
 * is used to store schema descriptions, and table listings in connections.
 */
Cache::config('_cake_model_', array(
    'engine' => $engine,
    'prefix' => $prefix . 'cake_model_',
    'path' => CACHE . 'models' . DS,
    'serialize' => ($engine === 'File'),
    'duration' => $duration
));

我们的前缀未在其他任何应用程序中使用。

会话配置:

/**
 * Session configuration.
 *
 * Contains an array of settings to use for session configuration. The defaults key is
 * used to define a default preset to use for sessions, any settings declared here will override
 * the settings of the default config.
 *
 * ## Options
 *
 * - `Session.cookie` - The name of the cookie to use. Defaults to 'CAKEPHP'
 * - `Session.timeout` - The number of minutes you want sessions to live for. This timeout is handled by CakePHP
 * - `Session.cookieTimeout` - The number of minutes you want session cookies to live for.
 * - `Session.checkAgent` - Do you want the user agent to be checked when starting sessions? You might want to set the
 *    value to false, when dealing with older versions of IE, Chrome Frame or certain web-browsing devices and AJAX
 * - `Session.defaults` - The default configuration set to use as a basis for your session.
 *    There are four builtins: php, cake, cache, database.
 * - `Session.handler` - Can be used to enable a custom session handler. Expects an array of callables,
 *    that can be used with `session_save_handler`. Using this option will automatically add `session.save_handler`
 *    to the ini array.
 * - `Session.autoRegenerate` - Enabling this setting, turns on automatic renewal of sessions, and
 *    sessionids that change frequently. See CakeSession::$requestCountdown.
 * - `Session.ini` - An associative array of additional ini values to set.
 *
 * The built in defaults are:
 *
 * - 'php' - Uses settings defined in your php.ini.
 * - 'cake' - Saves session files in CakePHP's /tmp directory.
 * - 'database' - Uses CakePHP's database sessions.
 * - 'cache' - Use the Cache class to save sessions.
 *
 * To define a custom session handler, save it at /app/Model/Datasource/Session/<name>.php.
 * Make sure the class implements `CakeSessionHandlerInterface` and set Session.handler to <name>
 *
 * To use database sessions, run the app/Config/Schema/sessions.php schema using
 * the cake shell command: cake schema create Sessions
 *
 */
    Configure::write('Session', array(
        'defaults' => 'cake'
    ));

我们已经尝试过的东西

  • 将“会话”配置更改为PHP,cake和cache(都不起作用)
  • 重新启动Apache
  • 还原项目的旧版本
  • 从我们的页面更​​改标题

    让JS每次都进行刷新似乎是一个糟糕的解决方案,因为我们不知道何时进行强制刷新。

很抱歉,如果不清楚或我的语法不正确。您可能需要的其他任何信息,我都会尽快更新。

谢谢。

0 个答案:

没有答案