2

All my sites are return 301 response code instead of 200. My sites are hosted on amazon aws and my dns are managed by cloudflare. I am using free ssl from cloudflares.

I was testing my site in third party websites. And it seems everywhere i am getting the following error:

Your server did not return a valid HTTP code (You returned 301 when you should have returned 200).

My server is configured using nginx. this is my nginx server code:

server {
        listen 80;
        listen 443 ssl;
        root /media/6sense/www/shajao.com;
        index index.html index.htm index.nginx-debian.html;
        server_name shajao.com www.shajao.com;
        location / {
                try_files $uri$args $uri$args/ /index.html;
        }
}

This is my website. https://shajao.com/

Ahsan Aasim
  • 1,177
  • 3
  • 14
  • 40

1 Answers1

0

Your site returns a 301 when requested over HTTP, in order to redirect to HTTPS. That is, if someone tries to fetch http://shajao.com, they get a 301 redirect to https://shajao.com. This is a good thing: Everyone should use HTTPS instead of HTTP. If you tell those third-party web sites to use HTTPS, it should work -- make sure to type in your web site URL starting with https://. With that said, if you really want to allow traffic over HTTP, you can turn off the option "Always Use HTTPS" in your Cloudflare settings.

Kenton Varda
  • 41,353
  • 8
  • 121
  • 105