title: Flask session cookie not set in Safari
body: <p>I experienced a strange behavior with my session cookie: Running the flask app on my mac, everything works fine and on any browser the cookie is set.</p>
  
  <p>However, if I run it on a windows server, the session cookie is not set on Safari (and iOS) - but still works on any other browsers. How can this happen? Here is an example of a simple app:</p>
  
  <pre><code>import os
  import uuid
  from flask import Flask, render_template, session
  
  app = Flask(__name__)
  
  SESSION_LIFETIME = 3600
  
  @app.before_request
  def before_request():
  
      # create session
      if not session.get('uid'):
          session.permanent = True
          session['uid'] = uuid.uuid4()
  
  @app.route('/', methods=['GET'])
  def test():
  
      return render_template('test.html')
  
  if __name__ == "__main__":
      app.secret_key = os.urandom(24)
      app.permanent_session_lifetime = SESSION_LIFETIME
      app.debug = True
      app.run(threaded=True,
              host="0.0.0.0",
              port=int("5000")
              )
  </code></pre>
  
  <p>with an example test.html:</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
  &lt;head lang="en"&gt;
      &lt;meta charset="UTF-8"&gt;
      &lt;title&gt;Wubwub&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
  Jojo
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>Why does it work on any browser but not on the (important) Safari? And why does the same code work when run on my mac (accessed from both outside and local), but not on windows? All other browsers work with windows (even from outside).</p>