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

Having Port for the public address #32

Open
alanmilinovic opened this issue Mar 15, 2024 · 10 comments
Open

Having Port for the public address #32

alanmilinovic opened this issue Mar 15, 2024 · 10 comments

Comments

@alanmilinovic
Copy link

Is it possible to have port? Like this pcarrier.gh.srv.us:8088 and of course stil have a secure connection with SSL.

@pcarrier
Copy link
Owner

Sorry but not today, everything goes through a single port and the hostname is used to differentiate between instances. What would be the use case, if you don't mind sharing?

@alanmilinovic
Copy link
Author

Simply having multiple applications tunneled on a different ports and avoid doing revers proxy.

@pcarrier
Copy link
Owner

pcarrier commented Apr 18, 2024

You can have multiple applications on multiple ports, they'll each get a unique hostname. We show that in examples like https://docs.srv.us/#demo. Is that not acceptable?

@alanmilinovic
Copy link
Author

You can have multiple applications on multiple ports, they'll each get a unique hostname. We show that in examples like https://docs.srv.us/#demo. Is that not acceptable?

I am talking about a public hostname, that is always without a port. It is ok to have unique hostname for every application, but I am missing having the port for example: jdoe.gh.srv.us:8088

@pcarrier
Copy link
Owner

pcarrier commented Apr 19, 2024

You have a port, it's 443. If you want another one I'd like to understand the use case.

@alanmilinovic
Copy link
Author

alanmilinovic commented Apr 19, 2024

You have a port, it's 443. If you want another one I'd like to understand the use case.

I know, can there be other ports that I can use?

@pcarrier
Copy link
Owner

pcarrier commented Apr 21, 2024

We're running in circles. What's the use case for a different port please? Why not separate hostnames instead? I'm open to considering your problem I just need to know what it is.

@alanmilinovic
Copy link
Author

alanmilinovic commented Apr 22, 2024

Ok, so basically, I have applications listening on different ports that I both use locally when I am at home and also when I leave my house. Whenever I am calling those applications I use javascript "window.location.hostname:8088" when constructing my url. That way I automated easily when I am at home I use local IP plus port and when I am outside it will switch to public hostname plus port.

Another example is Home Assistant application, where I use iframe feature, where you need to specify url. I construct url also the same way by using javascript window.location. As Home Assistant mobile application can have internal and external address, it is resolved depending whether you are connected to the home wifi or on mobile internet, so my iframe is then also perfectly resolved if I use the same port.

More info here:
https://community.home-assistant.io/t/new-addon-access-machines-in-your-homenet-with-apache-guacamole-ingress-support/209829/56?u=alanmilinovic

Now, when I am inside my local network I have port 8088 for example and outside for public network I have 443 port, I have a mismatch and windows.location.hostname+'8088' will not work dynamically.

@pcarrier
Copy link
Owner

pcarrier commented Apr 22, 2024

I see, thanks. Have you considered putting everything on the same port with different hostnames and/or paths through proxying, eg via nginx?

It could look something like this for distinct paths:

http {
  server {
    listen [::]:80 reuseport;
    listen 80 reuseport;
    location / {
      proxy_pass http://127.0.0.1:8080;
    }
    location /foo {
      proxy_pass http://127.0.0.1:8081;
    }
    location /bar {
      proxy_pass http://127.0.0.1:8082;
    }
  }
}

While it'd be theoretically possible to allow for more ports for the same hostname, I'm not quite sure how you'd choose them through ssh's interface (the flag -R remoteport:localaddress:localport doesn't have any extra space given I already use remoteport to map to a hostname).

@alanmilinovic
Copy link
Author

I see, thanks. Have you considered putting everything on the same port with different hostnames and/or paths through proxying, eg via nginx?

It could look something like this for distinct paths:

http {
  server {
    listen [::]:80 reuseport;
    listen 80 reuseport;
    location / {
      proxy_pass http://127.0.0.1:8080;
    }
    location /foo {
      proxy_pass http://127.0.0.1:8081;
    }
    location /bar {
      proxy_pass http://127.0.0.1:8082;
    }
  }
}

While it'd be theoretically possible to allow for more ports for the same hostname, I'm not quite sure how you'd choose them through ssh's interface (the flag -R remoteport:localaddress:localport doesn't have any extra space given I already use remoteport to map to a hostname).

Thanks for a reply. Yes I am proxying a lot, but there are some apps that doesn't work or have problems when I proxy them, mostly because of bad architecture and "base url" that is not working.

Hm, I can see the challenge around ssh interface and syntax. Not sure how to handle it but happy to test it if you can make any feasible solution.

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

2 participants