Why 307 redirects from http -> https instead of 301?


(Russ Savage) #1

I'm curious about the decision to use 307 redirects from http -> https instead of 301. Everything that I've read seems to say that a 307 is a temporary redirect, similar to 302. Why not make those redirects to https permanent (301)? This would tell webcrawers that they can link directly to the https version of the page and avoid the redirect in the future.

Right now, nearly all of our discuss.elastic.co pages have the http version indexed on Google.

Thanks,
Russ


(Sam Saffron) #2

307 is coming from your browser, we have HSTS here, so browser issue the 307 in dev tools, if you use curl it will be a 301.


(Russ Savage) #3

Using curl, I'm actually seeing a 302 response, not a 301. Is there something I'm missing?

~ rsavage$ curl 'http://discuss.elastic.co/c/elasticsearch' -v
* Hostname was NOT found in DNS cache
*   Trying 64.62.211.227...
* Connected to discuss.elastic.co (64.62.211.227) port 80 (#0)
> GET /c/elasticsearch HTTP/1.1
> User-Agent: curl/7.37.1
> Host: discuss.elastic.co
> Accept: */*
>
< HTTP/1.1 302 Found
< Cache-Control: no-cache
< Content-length: 0
< Location: https://discuss.elastic.co/c/elasticsearch
< Connection: close
<
* Closing connection 0

(Sam Saffron) #4

ahhh .. k yeah we can change that to a 301 in haproxy...


(Sam Saffron) #5

Cool, fixed it up:

sam@ubuntu discourse % curl 'http://discuss.elastic.co/c/elasticsearch' -v
* Hostname was NOT found in DNS cache
*   Trying 64.62.211.227...
* Connected to discuss.elastic.co (64.62.211.227) port 80 (#0)
> GET /c/elasticsearch HTTP/1.1
> User-Agent: curl/7.35.0
> Host: discuss.elastic.co
> Accept: */*
> 
< HTTP/1.1 301 Moved Permanently
< Content-length: 0
< Location: https://discuss.elastic.co/c/elasticsearch
< Connection: close
< 
* Closing connection 0

(Russ Savage) #6

Great! Thanks!


(Russ Savage) #7

(Mark Walkom) #8

(system) #9