jquery의 https질문 있습니다. > 십년전오늘

십년전오늘

10년전 추억의 책장을 넘기며

jquery의 https질문 있습니다. 정보

jquery의 https질문 있습니다.

본문

현재 인증서 설치하고 통으로 https로 접속해서 송수신하는데요..
액션 경로나 기타 링크등이 모두 상대경로라서 처음부터 끝까지 https로 되고는 있습니다.
한 가지 궁금한 것은 jquery의 $.post 등으로 많은 송수신을 하는데요..
https상에서 실행되면 ajax도 보안 송수신을 하는 것인가요?
아니면 요놈은 일반 http로 넣어주고 받는 것인지...
기초적인 개념이지만 잘 모르겠네요~ㅋ;

댓글 전체

Sure, you mentioned you were trying to do this:

$.ajax( url : 'https://somedomain.com/secure/somefile.aspx')

Instead, you have to do this (assuming your site is "mydomain.com"):

$.ajax( url : 'https://mydomain.com/remotecall.aspx')

That will load a page off of your server, but you want it from the remoteserver.  So remotecall.aspx on your server then has to perform the request, getthe result, and return it to the browser.  In other words, remotecall.aspx onyour server is acting as a proxy to the remote server.

I'd give you some example code for ASP.NET, but I don't program in it.  Here'swhat it would look like in the server-side language I do use, which is Lasso:

content_body = include_url('https://somedomain.com/secure/somefile.aspx',-postParams=client_postParams, -getParams=client_getParams,-SendMIMEHeaders=client_headers);

What it's doing is setting the response to the browser being the response fromthe remote server, and it's proxying the GET, POST, and request headers to theremote server.  That's a simple example, in the real world, if you use HTTPAuthentication or Cookies, or pass the session ID via a GET/POST param, thenyou'll want to filter out those headers/params before sending it on to theremote site to avoid leaking sensitive data.

The other tricky bit is if you're relying on the browser to already be loggedinto the remote site (either via a session cookie or HTTP Authentication) -- theuser's browser will not send your site the cookie or Auth headers needed toauthenticate to the remote server.  In that case, the user will have to provideyou with their username and password for the remote site in order for yourserver to masquerade as them.  If you control the remote server, then you cancode around this limitation.
감사합니다 아빠불당님ㅋ 아빠불당님이 글을 답글을 남겨주실 줄 알았는데ㅋ
그런데 내용을 대략 읽어보니 질문 내용과 다소 다른 것 같습니다; 영문의 내용은 같은 도메인이 아닌쪽과 https 송수신을 하려면 일종의 작업(?)이 필요하다는 것 같은데, 제 질문은 같은 도메인의 https상에서의 송수신이었습니다. 영어 실력이 좀 딸려서 잘못 이해한 것일수도 있으니 잘못 이해했다면 넓은 아량 부탁드립니다^^; 구글링을 조금 더 해보니 제가 생각하기에 관련 답변을 찾은 것 같기도 하네요. ”same origin policy에 의해 같은 프로토콜 같은 도메인 상이면 된다.” 정도로 정리할 수가 있을까요..
http://stackoverflow.com/questions/148068?sort=votes
같은 도메인이더라도, 위처럼 쓰는게 맞습니다. write.skin.php를 참조하세요.

    <?
    if ($g4[https_url])
        echo "f.action = '$g4[https_url]/$g4[bbs]/write_update.php';";
    else
        echo "f.action = './write_update.php';";
    ?>

더구나 공인인증서는 www.a.co.kr 하나로 받으면 싸고 (1년에 10만원대),
a.co.kr도 같이 쓰려면 멀티도메인이 되어서 많이 비쌉니다.

그래서, 저도 www.a.co.kr 하나로 발급받아서 접속도메인을 1개로 제한하고 있어요.
일단 config.php에서 말씀하신바와 같이 도메인을 고정시키기 위해서 http와 https도메인을 적어줘서 해봤었는데요..위와 같이 되는 경우에는 위 조건문이 들어간 로그인이나 글쓰기 폼에서만 보안 송신을 하기 때문에 효율적이기는 하나, 보통의 경우에는 http프로토콜로 돌아오기 때문에 ajax에서도 일반 http프로토콜을 쓰는 것 같더라구요.. 대부분 ajax로 송수신을 해야했기 때문에 아예 로그인시 보안체크를 받고 보안체크를 받으면 지정된 https 도메인으로 접속이 되도록 만들었습니다ㅋㅋ
전체 135,051
십년전오늘 내용 검색

회원로그인

(주)에스아이알소프트 / 대표:홍석명 / (06211) 서울특별시 강남구 역삼동 707-34 한신인터밸리24 서관 1402호 / E-Mail: admin@sir.kr
사업자등록번호: 217-81-36347 / 통신판매업신고번호:2014-서울강남-02098호 / 개인정보보호책임자:김민섭(minsup@sir.kr)
© SIRSOFT