Ionic 학습 노트 5 크로스 도 메 인 처리 및 HTTPS 문제 처리
3106 단어 App-Ionic
cordova plugin add cordova-plugin-whitelist
config. xml 설정
<allow-navigation href="http://*/*" />
<allow-intent href="*" />
<access origin="*" />
csp 설정
"Content-Security-Policy" content="default-src *;style-src 'self' 'unsafe-inline';script-src http://192.10.200.105:8080 http://192.10.200.105 'unsafe-inline' 'self' 'unsafe-eval'">
GapDebug 를 사용 할 때 도 CSP 에 가입 해 야 합 니 다. 그렇지 않 으 면 ios 10 이 잘못 보 고 될 수 있 습 니 다.
"Content-Security-Policy" content="default-src * data:cdvfile: gap: ;style-src 'self' 'unsafe-inline';script-src http://abc:8080 http://def.com 'self' 'unsafe-inline' 'unsafe-eval'">
코드 요청:
$http({
url:'your url',
method:"GET",
cache:false
}).then(function(response){
console.log(response);
},
function(response){
console.log(response);
}
);
실천 중 문제 발생: 제시:
from cache caution:provisional headers are shown
해결 방법 은 화이트 리스트 를 삭제 하고 다시 설치 하 는 것 이다
cordova plugin remove cordova-plugin-whitelist
HTTPS
debug 모드 에서 ionic 는 인증서 인증 을 건 너 뛰 고 https 에 접근 하 는 데 문제 가 없습니다.release 버 전이 발표 되면 인증 서 를 인증 합 니 다.
통과 가능https://www.sslshopper.com/ssl-checker.html 사이트 의 인증서 가 올 바 르 게 설치 되 어 있 는 지 확인 하 십시오.예 를 들 어 intermediate certificate 가 없 으 면 https 서 비 스 를 정상적으로 접근 할 수 없습니다.