JQuery modal dialog form sending data over https

I already have a modal login dialog. The problem is that if the original page loads via http, I still want to pass the credentials to the server via https. And, of course, I want to do with a little rewrite of the working code, as it may be.

I cannot use JSONP for my case, because login data is transmitted to the server through an AJAX POST request.

Any ideas?

+3
source share
3 answers

A policy of the same origin makes this impossible (at least in browsers that do not support the XHR cross domain, which is enough).

( HTTP, , , SSL)

+2

, ? , https ( ), .

0

, , . SSL, JavaScript, / . SSL.

URL- " http://www.example.com/dir/page.html".

Compared URL                              Outcome   Reason
http://www.example.com/dir/page2.html     Success   Same protocol and host
http://www.example.com/dir2/other.html    Success   Same protocol and host
http://u:pass@www.example.com/x/o.html    Success   Same protocol and host
http://www.example.com:81/dir/other.html  Failure   Same protocol and host but different port
https://www.example.com/dir/other.html    Failure   Different protocol
http://en.example.com/dir/other.html      Failure   Different host
http://example.com/dir/other.html         Failure   Different host (exact match required)
http://v2.www.example.com/dir/other.html  Failure   Different host (exact match required)
http://www.example.com:80/dir/other.html  Depends   Port explicit. Depends on implementation in browser.

, Internet Explorer , .


, -, . :


, , , - , .

, -. -.

, , .

ssl, .

# Various rewrite rules.
<IfModule mod_rewrite.c>
  RewriteEngine on
  # Force <front> to ssl for modal use of secure log in module.
  RewriteRule http://www.example.net/^$ https://www.example.net [R=301,L]

. :

0

Source: https://habr.com/ru/post/1780232/


All Articles