What is the proper HTTP response to send for requests that require SSL/TLS

后端 未结 5 1538
长情又很酷
长情又很酷 2020-12-03 16:38

I\'m designing an RESTful API where some calls are public over HTTP, and some require an API key and encryption over HTTPS. I\'m deliberating on what response code should b

5条回答
  •  借酒劲吻你
    2020-12-03 17:05

    Returning a 403 with reason phrase "HTTPS Required" seems like a practical option and what I use.

    see https://en.wikipedia.org/wiki/HTTP_403

    Redirecting a REST Api is not a good idea especially as you may have no idea as to how or what is consuming your service.

提交回复
热议问题