Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
benzmuircroft opened this issue Sep 24, 2023 · 6 comments
Open

Comments

@benzmuircroft
Copy link

benzmuircroft commented Sep 24, 2023

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

#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
Copy link

F4brizio commented Oct 3, 2023

Could you solve it?

@benzmuircroft
Copy link
Author

nope

@j-peace
Copy link

j-peace commented Oct 3, 2023

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
Copy link
Author

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

@j-peace
Copy link

j-peace commented Oct 4, 2023

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

#203 (comment)

After that, let me know if the problem persisst.

First of all, try with node 16.

@benzmuircroft
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants