开发者

HTTPS switches to HTTP

开发者 https://www.devze.com 2022-12-22 10:42 出处:网络
I login to a webpage using http:// I get redirected by javascript tohttps://. This opens a login page under https.After logging on successfully the next page is in http again. Why didn\'t the next pag

I login to a webpage using http:// I get redirected by javascript to https://. This opens a login page under https. After logging on successfully the next page is in http again. Why didn't the next page open with https as well. I am usin开发者_Python百科g JETTY as web server.


Are you posting your login form to http://mysite.com/login.php?

If so, I'd recommend using a relative link (e.g. <form action="login.php" method="POST">)


Encryption is usually only used when transferring sensitive data such as usernames and passwords (or your online bank account).

For an otherwise public website like StackOverflow it's impractical to use HTTPS for anything other than the login credentials because if every logged in user at StackOverflow would use HTTPS for every page-view the site could be too expensive to run because encryption is resource heavy which means it would require more hardware.

The server-side software could work something like this at the login page:

  1. User goes to login page http://mysite.com/login
  2. Login page is displayed. The HTML form points to https://mysite.com
  3. User types username/password and submits the form over an encrypted session
  4. User lands on "Login successful" page which redirects to the unencrypted http://mysite.com/

HTTP supports redirects in the header using the Location command:

Location: http://www.example.org/
Content-Type: text/html
Content-Length: 174

Hope this helps!

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号