title: Chrome not handling "308 - Permanent Redirect" redirects as expected on HTTPS
body: <p>I am running a web server on Sinatra behind an Nginx reverse proxy server. It is a requirement that HTTP requests are all redirected to HTTPS, so that is my current configuration.</p>
  
  <pre><code>map $http_upgrade $connection_upgrade {                                            
      default Upgrade;                                                               
      '' close;                                                                      
  }                                                                                  
  
  ## Listen on port 80 for HTTP requests, redirect to https                          
  server {                                                       
      listen 80 default;                                                             
      listen [::]:80 default;                                                        
      return 308 https://$host$request_uri;                                          
  }                                                                                  
  
  
  ## Use HTTPS when requests are made                                                
  server {                                                                           
    listen 443 ssl;                                                                  
  
    # don't allow old ssl protocols                                                  
    ssl_protocols TLSv1 TLSv1.1 TLSv1.2;                                             
  
    # ensure that our ciphers are preferred, and give a list of preferred ciphers    
    ssl_prefer_server_ciphers on;                                                    
    ssl_ciphers ECDH+AESGCM:ECDH+AES256:ECDH+AES128:DH+3DES:!ADH:!AECDH:!MD5;        
  
    # enable session tickets                                                         
    ssl_session_tickets on;                                                          
  
    # TLS session cache 4 hours, 40 MB                                               
    ssl_session_cache   shared:SSL:40m;                                              
    ssl_session_timeout 4h;                                                          
  
    ssl_certificate /data/projects/cloudpeel-next/cloudpeel.crt;                     
    ssl_certificate_key /data/projects/cloudpeel-next/cloudpeel.key;                 
  
    location / {                                                                     
      proxy_pass http://localhost:4567;                                              
      proxy_http_version 1.1;                                                        
      proxy_set_header Upgrade $http_upgrade;                                        
      proxy_set_header Connection $connection_upgrade;                               
      proxy_set_header Host $host;                                                   
      proxy_set_header X-Real-IP $remote_addr;                                      
    }                                                                                
  }                                                                                  
  </code></pre>
  
  <p>This works great in most cases, except when a POST request occurs from the client. Ideally the 308 (or 307) redirect is supposed to preserve the POST data and request the client again to request a different address (in this case the HTTPS version of the site). </p>
  
  <p>However, what occurs in Chrome, is that the request is handled (as far as I can tell more like a 301 redirect, and the request is interpreted as GET, for which my backend has different behavior, redirecting the user to an incorrect page.</p>
  
  <p>I have tried using return 301 and 307, with neither producing the desired results. </p>
  
  <p>The curious thing, is that when tested in Edge and Firefox, the application works exactly as expected.</p>
  
  <p>The network tab in the developer shows the following: a 303 code for a POST attempt and a 308 GET, which is not the desired behavior. In Firefox, only code 200 is shown. Is there anything I can do about this in my Nginx configuration?</p>
  
  <p><strong>Edit:</strong> I tried changing my redirect in Nginx to 301, and Firefox still works as intended, while Chrome is still broken. </p>