我的系統上運行着許多不同的服務器,它們都在自己的端口上運行安全連接等。50001,50002,50003 ...
所有thees可以從https://domain1.com:50001直接訪問...
現在,我不僅想限制端口的數量,而且還改變了這麼等我該如何正確代理到另一個https服務器的https請求
https://domain1.com:50001 <- https://srv1.domain2.com:443
https://domain1.com:50002 <- https://srv2.domain2.com:443
https://domain1.com:50003 <- https://srv3.domain2.com:443
thees的所有服務器上運行的域單獨的nodejs實例。
現在我想建立一個代理而不是重定向這個,我選擇了nodejs,因爲我們所做的一切都在nodejs中。
我現在有:
var app = require('express')();
var options = {
key : fs.readFileSync(CONFIG.sslKey).toString(),
cert : fs.readFileSync(CONFIG.sslCertificate).toString(),
ca : fs.readFileSync(CONFIG.sslCA).toString()
};
var http = require('https').Server(options,app);
var httpProxy = require('http-proxy');
var proxy = httpProxy.createProxyServer({
ssl: {
key : fs.readFileSync(CONFIGsecure.sslKey).toString(),
cert : fs.readFileSync(CONFIGsecure.sslCertificate).toString(),
ca : fs.readFileSync(CONFIGsecure.sslCA).toString()
},
secure: true
});
var handleRequests = function(req, res){
proxyTo = "https://domain1.com:50001"; <= some logic chooses this based on req.headers.host
proxy.web(req, res, { target: proxyTo });
};
app.get('/*', handleRequests);
app.post('/*', handleRequests);
app.put('/*', handleRequests);
app.delete('/*', handleRequests);
http.listen(443, function(){});
好了,所以這實際上工作得非常好,一切都在使用jQuery AJAX一切也工作得非常好要去的地方應該在瀏覽器中去,並在科爾多瓦的應用程序。 但是如果我使用
FileTransfer().download(...)
我得到錯誤代碼3(連接錯誤)。
如果我直接連接到https://domain1.com:50001(直接)該應用程序的作品,但如果我連接到https://srv1.domain2.com:443(代理)該應用程序不起作用。
所有證書都是有效的,*。domain2.com上的通配符證書和domain1.com上的單個證書。
終端服務器安裝了domain1.com證書,並且代理安裝了* .domain2.com通配符證書。
關於如何正確設置代理服務器的任何想法?該系統是Windows Server 2012 R2,如果需要,我可以使用真實代理。然而,儘可能簡單的解決方案會很好。
我已經嘗試了例如兩個形式在這裏:
http://blog.nodejitsu.com/http-proxy-intro/
然而,這是同樣的問題,它只是GET請求。
我也曾嘗試前端服務器上禁用HTTPS所以這就是它的只有是安全的,但是,同樣的結果,代理...
謝謝...