Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8524875
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T07:48:41+00:00 2026-06-11T07:48:41+00:00

How do I ensure that all requests to our API is via https? Do

  • 0

How do I ensure that all requests to our API is via https? Do we use an .htaccess file to automatically redirect to ssl, or should we just refuse connections that are not over https with an error message? If its the second one, whats the best way of achieving this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T07:48:42+00:00Added an answer on June 11, 2026 at 7:48 am

    You should make life as easy as possible for the users of your API – but “easy” for a developer usually means explicit.

    My strong preference in these situations is to treat this as a violation of a pre-condition, and throw an error. If your API is RESTful, one of the HTTP errors has my preference – e.g. a custom error 503 FORBIDDEN, with custom text explaining you must connect on SSL.

    A developer who mistakenly connects to the non-encrypted service end point will get immediate, clear, human-readable feedback.

    I would caution against a redirect – this achieves its goal as a side effect, and may well work when the developer connects using a web browser, and fail when using their web service client (not all of which play nice with redirects, in my experience).

    I would also prefer throwing an error over simply not opening the HTTP port/listener – it usually takes a while for the connection to time out, which would lead your client developer to think the server is down, rather than immediately realize the root cause of the error.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How can I ensure that all data that I've erase from the db tables,
I have added a checker to ensure that all fields in a form have
I have written some code to ensure that items on an order are all
Is there any provisions in rails that would allow all AJAX POST requests from
I want to redirect all incoming requests to my root domain, and found the
I am trying to ensure that all URLs used to access my ASP.NET MVC
How can I ensure that information isn't returned from a webmethod or mvc action
I need to ensure that the user login form for Drupal can not be
I want to ensure that a division of integers is always rounded up if
How does C++ ensure that destructors are called for stack assigned objects? What happens

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.