KCP의 간편결제중 네이버페이 에러(X-Frame-Options)

KCP의 간편결제중 네이버페이 에러(X-Frame-Options)

QA

KCP의 간편결제중 네이버페이 에러(X-Frame-Options)

본문

KCP를 이용중입니다.
모바일 쇼핑몰에서 간편결제중 네이버 페이로 결제를 하면

-------------에러메세지--------------
Refused to display 'https://nid.naver.com/nidlogin.login?svctype=262144&url=https%3A%2F%2Fm.pay.naver.com%2Fz%2Fpayments%2Fauth-pay%2F20201028bjZ1OWtaUTJXZGhFWVMwM1dyVU1lYVl1WkRvPQ%3D%3D' in a frame because it set 'X-Frame-Options' to 'sameorigin'.
-------------에러메세지--------------

이렇게 나오면서 네이버 결제창이 안보입니다.

PC는 정상작동됩니다, 모바일에서도 카카오페이등의 간편결제도 이상없이 작동됩니다.

iframe 호출시 특정 소스가 필요한지 문의드립니다.
 

 

소스 => /mobile/shop/kcp/order_approval_form.php



<!-- 스마트폰에서 KCP 결제창을 레이어 형태로 구현-->
<div id="layer_receipt" style="position:absolute; left:1px; top:1px; width:100%;height:100%; z-index:1; display:none;">
    <table width="100%" height="100%" border="-" cellspacing="0" cellpadding="0" style="text-align:center">
        <tr height="100%" width="100%">
            <td>
                <iframe name="frm_receipt" frameborder="0" border="0" width="100%" height="100%" scrolling="auto"></iframe>
            </td>
        </tr>
    </table>
</div>

이 질문에 댓글 쓰기 :

답변 2

/etc/apache2/conf-available/security.conf 에서 다음  코드 앞의 #을 넣어 주석 처리 하시면 됩니다.

header("X-Frame-Options: SAMEORIGIN"); <---같은 사이트 주소만 허용할때 사용합니다

 


#Header set X-Frame-Options: "sameorigin"  

 

추가: 만약 호스팅을 사용중이시라면 호출페이지 상단에 header("X-Frame-Options: allow-from https://nid.naver.com");

자체해결입니다.
/mobile/shop/kcp/order_approval_form.php => line 171

if(!(typeof v_frm.naverpay_direct !== "undefined" && v_frm.naverpay_direct.value === 1)) {  

        // 네이버페이면 반드시 페이지전환 방식이어야 하며, 그 외에는 iframe 방식으로 한다.
        if(!(typeof v_frm.naverpay_direct !== "undefined" && v_frm.naverpay_direct.value === 'Y')) {      // 네이버페이가 아니면
            v_frm.target = "frm_receipt";
        }

 

이렇게 수정하니 정상작동합니다.

 

답변주신 스피드S 님 감사합니다.

답변을 작성하시기 전에 로그인 해주세요.
전체 226
QA 내용 검색

회원로그인

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