프런트 엔드 wepp 앱의 REST 요청을 외부 Jira 서버의 API로 전송하려고합니다.노드 http-proxy : 외부 https 사이트로 트래픽 포워드 - 크래시
나는이 노드를 http-proxy으로 사용하고 있는데, 이는 http 서버 인 Jira 서버에서 OK입니다.
하지만 이제 https에 대해 별도의 서버를 만들고 싶습니다.
그래서 나는 지금이 this 예에 솜 변경 :var path = require('path'),
fs = require('fs'),
httpProxy = require('http-proxy'),
certFolder = '/my/cert/folder';
//
// Create the HTTPS proxy server listening on port 8002
//
httpProxy.createServer({
//(placeholder address)
target: {
host: 'https://ext.jiraserver.com',
port: 443
},
// letsencrypt cert
ssl: {
key: fs.readFileSync(path.join(certFolder, 'privkey.pem'), 'utf8'),
cert: fs.readFileSync(path.join(certFolder, 'fullchain.pem'), 'utf8')
},
secure: true
}).listen(8002);
console.log('https proxy server started on port 8002');
을하지만 내 서버에 요청을 할 때, https://my.domain.com:8002는 오류 메시지와 함께 서버 충돌 :
.../node_modules/http-proxy/lib/http-proxy/index.js:119 throw err; ^
Error: getaddrinfo ENOTFOUND https://ext.jiraserver.com https://ext.jiraserver.com:443 at errnoException (dns.js:28:10) at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:76:26)
I을 그것을 작동시킬 수없는 것 ... 서버가 온라인 상태이고 주소가 정확하므로 무엇이 잘못되었는지 알지 못합니다.
내 코드가 잘못되었거나 제대로 작동하려면 어떻게해야합니까?
감사합니다.
나는 그것을 시도하고 단지 얻을 : 400 나쁜 요청 - 일반 HTTP 요청을 HTTPS 포트로 보냈습니다. httpProxy가 https가 아닌 http- 서버를 시작한 것처럼 느껴지십니까? – mottosson
@mottosson'target' 설정에'https : true'를 추가해보십시오. – cgTag
그래도 같은 오류 메시지가 나왔는데 ... : - \ – mottosson