0
내 시스템에서 로컬 노드 js 서버를 실행 중이고 ngrok.io
도메인을 제공합니다.http 익스프레스 라우트의 혼합 컨텐츠 오류
localhost:3000
또는 http://1234.ngrok.io
을 사용하여 웹 브라우저에서 로컬로 실행하면 모든 문제가 해결됩니다. 내가 httpS://1234.ngrok.io
로 호출하면 나는 경로가없는 HTTP 때문에
Mixed Content: The page at 'https://1234.ngrok.io/' was loaded over HTTPS, but requested an insecure XMLHttpRequest endpoint 'http://localhost:3000/calculation'. This request has been blocked; the content must be served over HTTPS.
가 발생하는 오류가 발생합니다. 이 문제를 어떻게 해결할 수 있습니까?
이
내 Node.js를에 app.js입니다const express = require('express');
const app = express();
const https = require('https');
const http = require('http');
const fs = require('fs');
app.use('/', express.static(__dirname + '/../Client'));
var options = {
key: fs.readFileSync('./https_certificate/client-key.pem'),
cert: fs.readFileSync('./https_certificate/client-cert.pem')
};
app.listen(server_connection.port,() => {
console.log('Server started on port ' + server_connection.port);
//do stuff
});
//load the index.html from the server
app.get('/', function(req, res) {
res.sendFile(path.join(__dirname + '/../Client/index.html'));
});
이 오류를 발생시키는 경로와 다른 파일입니다
const express = require('express');
const router = express();
router.post('/calculation', function(req, res) {
//do stuff
}
가 이미에 대한 서버를 구성하려 htt38 첫 번째 파일의 options
개체에서 볼 수있는 방법은 502 잘못된 게이트웨이에서 해결되었습니다.
또한 https 만 사용하고 싶습니다. 다른 사람이 http를 사용하면 https로 리디렉션 할 수 있습니까?
너무 쉽습니다. 그 덕분에, 고마워. – WeSt