--print-requests not printing anything when I try to visit the url
benzmuircroft opened this issue · comments
On My Server
# Show the certificates
certbot certificates
Certificate Name: x4ey71ra9q.mysite.com
Serial Number: 4ca7357461bc008cba443c8b13c5c080dff
Key Type: ECDSA
Domains: mysite.com x4ey71ra9q.mysite.com
Expiry Date: 2023-12-23 10:30:55+00:00 (VALID: 89 days)
Certificate Path: /etc/letsencrypt/live/x4ey71ra9q.mysite.com/fullchain.pem
Private Key Path: /etc/letsencrypt/live/x4ey71ra9q.mysite.com/privkey.pem
# Allow port
iptables -I INPUT -m state --state NEW -m tcp -p tcp --dport 1234 -j ACCEPT
# Start the tunnel server using the version from #131
SSL_KEY=/etc/letsencrypt/live/x4ey71ra9q.mysite.com/privkey.pem SSL_CERT=/etc/letsencrypt/live/x4ey71ra9q.mysite.com/fullchain.pem node -r esm ./bin/server --port 1234 --domain mysite.com --secure
localtunnel server listening on port: 1234 +0ms
localtunnel:server making new client with id x4ey71ra9q +0ms
On My Desktop
# Allow port
iptables -I INPUT -m state --state NEW -m tcp -p tcp --dport 8080 -j ACCEPT
# Run The tunnel
lt -h https://mysite.com:1234 -p 8080 -s "x4ey71ra9q"
your url is: https://x4ey71ra9q.mysite.com:1234
# Start the local server
node /home/benz/Desktop/localhost/index.js
Server is running on port 8080
index.js
const http = require('http');
const fs = require('fs');
const path = require('path');
const server = http.createServer((req, res) => {
//const filePath = path.join(__dirname, req.url);
fs.readFile(path.join(__dirname, 'index.html'), 'utf8', (err, data) => {
console.log(err);
if (err) {
// Handle file not found or other errors
res.writeHead(500, { 'Content-Type': 'text/plain' }); // res.writeHead(404, { 'Content-Type': 'text/plain' });
res.end('File not found');
} else {
// Serve the file with the appropriate content type
res.writeHead(200, { 'Content-Type': 'text/html' });
res.end(data);
}
});
});
const port = 8080;
server.listen(port, () => {
console.log(`Server is running on port ${port}`);
});
index.html
<!DOCTYPE html>
<html>
<head>
<title>Hello World</title>
</head>
<body>
<h1>Hello, World!</h1>
</body>
</html>
I can see 'Hello World!' at http://localhost:8080/ but if I go to https://x4ey71ra9q.mysite.com:1234 it shows that the certificate is ok and it shows 404 where the html body should be. I've changed the error response to be 500 if the is an error but it still shows 404.
If I do:
lt -h https://mysite.com:1234 -p 8080 -s "x4ey71ra9q" --print-requests
your url is: https://x4ey71ra9q.mysite.com:1234
It doesn't print anything when I visit the url
Could you solve it?
nope
Please share more details.
Can you give an overview about your repo?
Wich node version are you using ?
Is it stopping now ? Or never works before ?
@tiagopazhs
https://github.com/verseles/tunnel-server
v18.12.1
never worked / always as described above
ty
All rigth. So, can you try this tutorial to run local?
After that, let me know if the problem persisst.
First of all, try with node 16.
busy now with a job, I will gladly try your tutorial as soon as I am free
ty again @tiagopazhs