2017-02-03 3 views
0

제목으로 아약스 호출을 사용하여 GET 요청을 보내기 위해 로그인 버튼을 누르면 별도의 Android 기기에서 Chrome의 원격 디버깅에서이 오류가 발생합니다. 그러나 브라우저에서 제대로 작동합니다. js 파일의 URL에있는 IP 주소를 공용 IP를 가리 키도록 변경했습니다.net :: ERR_CONNECTION_REFUSED on cordova app

Content-Security-Policy 헤더를 index.html에 추가하고 cordova 플러그인 허용 목록을 확인하고 allow-intent 및 allow-navigation을 내 config.xml 파일에 추가하는 등의 권장 단계를 수행했습니다. cordova.js 스크립트를 index.html 파일의 헤더에 추가해도 오류는 계속 발생합니다.

저는이 문제에 익숙합니다. 따라서 도메인을 게시해야하는 등의 오류가 발생할 수있는 다른 요소가 있는지 확실하지 않습니다. 다음은 오류의 스크린 샷입니다. 더 이상 제공 할 수있는 정보가 있는지 알려주십시오.

index.html을

<!DOCTYPE html> 
<html> 
    <head> 
    <title>AGW</title> 
    <meta http-equiv="Content-Security-Policy" content="default-src *; style-src 'self' 'unsafe-inline'; script-src 'self' 'unsafe-inline' 'unsafe-eval' http://PublicIPAddress/MP/applogin.php"> 
    <meta content="text/html;charset=utf-8" http-equiv="Content-Type"> 
    <meta content="utf-8" http-equiv="encoding"> 
    <!-- include css file here--> 
    <!-- include JavaScript file here--> 
    <script src="cordova.js"></script> 
    <script type= "text/javascript" src="js/jquery-3.1.1.js"></script> 
    <script type="text/javascript" src="js/validlogin.js"></script> 

    </head> 
    <body> 
    <div class="container"> 
     <div class="main"> 
      <form class="form" method="post" action="#"> 
      <h2>AGW</h2><hr/> 

      <label>Email :</label> 
      <input type="text" name="email" id="email"> <br /> 
      <br /> 
      <label>Password :</label> 
      <input type="password" name="password" id="password"> <br /> 
      </form><br /> 
      <br />   
      <input type="submit" name="login" id="login" value="Login"> 
      </form> 
     </div> 
    </div> 

    </body> 
</html> 

config.xml에

<?xml version='1.0' encoding='utf-8'?> 
<widget id="io.cordova.hellocordova" version="1.0.0" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0"> 
    <name>AWG Rewards System</name> 
    <description> 
     A sample Apache Cordova application that responds to the deviceready event. 
    </description> 
    <author email="[email protected]" href="http://cordova.io"> 
     Apache Cordova Team 
    </author> 
    <content src="index.html" /> 
    <plugin name="cordova-plugin-whitelist" spec="1" /> 
    <access origin="*" /> 
    <allow-intent href="http://*/*" /> 
    <allow-intent href="https://*/*" /> 
    <allow-intent href="tel:*" /> 
    <allow-intent href="sms:*" /> 
    <allow-intent href="mailto:*" /> 
    <allow-intent href="geo:*" /> 
    <allow-intent href="http://127.0.0.1/MP/*" /> 
    <allow-intent href="http://PublicIPAddress//MP/*" /> 
    <allow-navigation href="*" /> 
    <allow-intent href="*" /> 
    <platform name="android"> 
     <allow-intent href="market:*" /> 
    </platform> 
    <platform name="ios"> 
     <allow-intent href="itms:*" /> 
     <allow-intent href="itms-apps:*" /> 
    </platform> 
</widget> 
+1

config.xml의 allow-intent 구성에는 와일드 카드와 IP 사양 (allow-intent href = "http : // PublicIPAddress // MP/*")이 둘 다 있습니다. 와일드 카드 만 사용하고 확인해 주시겠습니까? – Gandhi

+0

아! 내가 참조. 나는 당신의 계단을 따라 갔고 코드의 IP 주소를 공인 IP가 아닌 로컬 IP로 변경하여 작동하도록했습니다. –

+0

다행이었습니다. 다른 사람의 이익을 위해 답변을 게시했습니다. 그것이 도움이 되었다면 받아들이고 upvote하십시오. 건배 – Gandhi

답변

1

문제가 함께 : 여기

enter image description here

는 코드이다 config.xml에 지정된 허용 설정입니다.

config.xml에는 와일드 카드 및 IP 기반 허용 가능 구성이 모두 지정되어 있습니다. 이 구성을 수정하고 적절한 IP를 언급하면이 작업을 수행해야합니다.

관련 문제