--print-requests not printing anything when I try to visit the url #204

Open
opened 2023-09-24 14:24:10 +00:00 by benzmuircroft · 6 comments
benzmuircroft commented 2023-09-24 14:24:10 +00:00 (Migrated from github.com)

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

⚠️ Please note: I run the tunnel server with --domain mysite.com
image

https://github.com/localtunnel/server/issues/131

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

# 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 ``` ⚠️ Please note: I run the tunnel server with --domain mysite.com ![image](https://github.com/localtunnel/server/assets/4244518/9d0f4fc1-1f26-4b48-a158-3f6ade123470) [https://github.com/localtunnel/server/issues/131](https://github.com/localtunnel/server/issues/131) # 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
F4brizio commented 2023-10-03 01:10:26 +00:00 (Migrated from github.com)

Could you solve it?

Could you solve it?
benzmuircroft commented 2023-10-03 13:58:15 +00:00 (Migrated from github.com)

nope

nope
tiagopazhs commented 2023-10-03 22:42:08 +00:00 (Migrated from github.com)

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 ?

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 ?
benzmuircroft commented 2023-10-04 10:35:16 +00:00 (Migrated from github.com)

@tiagopazhs
https://github.com/verseles/tunnel-server
v18.12.1
never worked / always as described above
ty

@tiagopazhs https://github.com/verseles/tunnel-server v18.12.1 never worked / always as described above ty
tiagopazhs commented 2023-10-04 11:38:09 +00:00 (Migrated from github.com)

All rigth. So, can you try this tutorial to run local?

https://github.com/localtunnel/server/issues/203#issuecomment-1728643319

After that, let me know if the problem persisst.

First of all, try with node 16.

All rigth. So, can you try this tutorial to run local? https://github.com/localtunnel/server/issues/203#issuecomment-1728643319 After that, let me know if the problem persisst. First of all, try with node 16.
benzmuircroft commented 2023-10-06 19:54:25 +00:00 (Migrated from github.com)

busy now with a job, I will gladly try your tutorial as soon as I am free
ty again @tiagopazhs

busy now with a job, I will gladly try your tutorial as soon as I am free ty again @tiagopazhs
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: hoelee/server#204
No description provided.