title: Rails' session does not persist on Chrome 67 and below
body: <p>I have 2 routes, one sets the session variable and one that reads it.</p>
  <p>But on Chrome 67 and below, the session variable doesn't persist.</p>
  <p>Here is a one file Rails app that reproduces the issue.</p>
  <pre class="lang-rb prettyprint-override"><code>require 'bundler/inline'
  
  gemfile(true) do
    source 'https://rubygems.org'
    gem 'rails', '~&gt; 5.0.6'
  end
  
  require 'rails'
  require 'action_controller/railtie'
  
  class TestApp &lt; Rails::Application
    config.eager_load = 'development'
    config.consider_all_requests_local = true
    config.secret_key_base = '669846b267cea64315663e4f5c124096'
    config.secret_token = '9c9846b2f7cea64315503e4f5c124094'
  
    routes.append do
      get '/' =&gt; 'api#index'
      post '/api/set' =&gt; 'api#set' # SET THE SESSION
      get '/api/get' =&gt; 'api#get' # READ THE SESSION
    end
  end
  
  class ApiController &lt; ActionController::Base
    HTML_STRING = &lt;&lt;-EOF
      &lt;script&gt;
        fetch('/api/set', { method: 'POST' }) // SET THE SESSION
          .then((r) =&gt; r.json())
          .then((r) =&gt; {
            console.log('SET: ', r);
  
            fetch('/api/get')
              .then((r) =&gt; r.json())
              .then((r) =&gt; console.log('GET: ', r)); // READ THE SESSION
          });
      &lt;/script&gt;
    EOF
  
    def index
      render :html =&gt; HTML_STRING.html_safe
    end
  
    def set 
      session[:x] = 'x'
  
      render :json =&gt; { :x =&gt; session[:x] }
    end
  
    def get
      render :json =&gt; { :x =&gt; session[:x] }
    end
  end
  
  TestApp.initialize!
  
  run TestApp
  </code></pre>
  <p>Save the file as <code>config.ru</code> and to run use <code>rackup -p 3030</code>.</p>
  <p>Output on Chrome 68 and above:</p>
  <pre class="lang-js prettyprint-override"><code>SET:  {x: 'x'}
  GET:  {x: 'x'}
  </code></pre>
  <p>Output on Chrome 67 and below:</p>
  <pre class="lang-js prettyprint-override"><code>SET:  {x: 'x'}
  GET:  {x: null}
  </code></pre>
  <p>Live Reproduction: <a href="https://hidden-mesa-94224.herokuapp.com/" rel="nofollow noreferrer">https://hidden-mesa-94224.herokuapp.com/</a></p>
  <p>I tested on almost all versions by using <a href="https://www.browserstack.com/" rel="nofollow noreferrer">BrowserStack</a> and found that the issue only persists on Chrome below 67.</p>
  <p>Chrome 67 Network Tab:
  <a href="https://i.stack.imgur.com/4QmKc.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/4QmKc.png" alt="Network Tab" /></a></p>
  <p>Chrome 95 Network Tab:
  <a href="https://i.stack.imgur.com/293ve.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/293ve.png" alt="enter image description here" /></a></p>