title: Flask post request: Secure Connection Failed
body: <p>I am trying to build a flask app (for user registration). The html code is as follows</p>
  <pre><code>    &lt;form method=&quot;POST&quot; action=&quot;{{ url_for('auth.signup_post') }}&quot;&gt;
                  &lt;div class=&quot;field&quot;&gt;
                      &lt;div class=&quot;control&quot;&gt;
                          &lt;input class=&quot;input is-large&quot; type=&quot;email&quot; name=&quot;email&quot; placeholder=&quot;Email&quot; autofocus=&quot;&quot;&gt;
                      &lt;/div&gt;
                  &lt;/div&gt;
      
                  &lt;div class=&quot;field&quot;&gt;
                      &lt;div class=&quot;control&quot;&gt;
                          &lt;input class=&quot;input is-large&quot; type=&quot;text&quot; name=&quot;name&quot; placeholder=&quot;Name&quot; autofocus=&quot;&quot;&gt;
                      &lt;/div&gt;
                  &lt;/div&gt;
      
                  &lt;div class=&quot;field&quot;&gt;
                      &lt;div class=&quot;control&quot;&gt;
                          &lt;input class=&quot;input is-large&quot; type=&quot;password&quot; name=&quot;password&quot; placeholder=&quot;Password&quot;&gt;
                      &lt;/div&gt;
                  &lt;/div&gt;
      
                  &lt;button class=&quot;button is-block is-info is-large is-fullwidth&quot;&gt;Sign Up&lt;/button&gt;
              &lt;/form&gt;
  </code></pre>
  <p>And the python side code is as follows</p>
  <pre><code>@auth.route('/signup')
  def signup():    
      return render_template('signup.html')
  
  
  @auth.route('/signup', methods=['POST'])
  def signup_post():
      default_role='member'
      
      email = request.form.get('email')
      name = request.form.get('name')
      password = request.form.get('password')
      
      user = User.query.filter_by(email=email).first()
      
      if user: 
          return redirect(url_for('auth.signup'))
  
      new_user = User(email=email, name=name, password=generate_password_hash(password, method='sha256'),role=default_role)
  
      db.session.add(new_user)
      db.session.commit()
      
      return redirect(url_for('auth.login'))
  
  </code></pre>
  <p>But irrespective of everything, whenever the form is submitted (or on a POST request), the browser gives an error.</p>
  <p><em><strong>Firefox:</strong></em> Secure Connection Failed</p>
  <p><em><strong>Chrome:</strong></em> err_http2_protocol_error</p>
  <p>PS:</p>
  <ul>
  <li>GET request doesn't give this error and works fine. What can be the issue here?</li>
  <li>Website has a valid SSL.</li>
  <li>I don't know if I need to give ssl_context in cgi config file. If I need, then how can I?</li>
  </ul>