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

localhost subdomain #44

Open
tcables opened this issue Mar 18, 2024 · 2 comments
Open

localhost subdomain #44

tcables opened this issue Mar 18, 2024 · 2 comments

Comments

@tcables
Copy link

tcables commented Mar 18, 2024

Hello,

I have multiple websites served from my asp.net core mvc app.

specifically, ct-1.localhost and ct-2.localhost.

this is the command line i tried:
npx iisexpress-proxy http://ct-1.localhost:62114 to 3000

and this is the response upon requesting it externally:

PS C:\Users\xxx> npx iisexpress-proxy ct-1.localhost:62114 to 3000
{
  _: [
    'C:\\Program Files\\nodejs\\node.exe',
    'C:\\Users\\xxxx\\AppData\\Roaming\\npm\\node_modules\\iisexpress-proxy\\index.js',
    'ct-1.localhost:62114',
    'to',
    3000
  ]
}
IIS Express Proxy 1.7.13
Proxying http://ct-1.localhost:62114 to network interfaces:
        Ethernet: http://192.168.1.171:3000
        Ethernet 2: http://192.168.56.1:3000
Listening... [press Control-C to exit]
Error: getaddrinfo ENOTFOUND ct-1.localhost
    at GetAddrInfoReqWrap.onlookupall [as oncomplete] (node:dns:118:26) {
  errno: -3008,
  code: 'ENOTFOUND',
  syscall: 'getaddrinfo',
  hostname: 'ct-1.localhost'
}
^C^CTerminate batch job (Y/N)? y

if I serve 62114 to 3000 my web portal shows, and displays my default behavior of showing me links to ct-1.localhost and ct-2.localhost, so the website is working correctly at bare minimum.

I have also tried ct-1.desktop-name:3000 and the browser returns IP not found.

I have used your tool many times for other web apps, and I am very happy it has worked so well!

This is just a out-of-the-norm use-case. Any help is appreciated, Thanks!

@tcables
Copy link
Author

tcables commented Apr 17, 2024

This was my fault. iisexpress-proxy tried to bind to vEthernet (WSL): http://172.20.16. which is docker and my Ethernet 2: http://192.168.56.1 which is VirtualBox's network. I told it to just bind to my home network address (192.168.1.171) and it worked fine. Sorry!

@tcables tcables closed this as completed Apr 17, 2024
@tcables tcables reopened this Jul 19, 2024
@tcables
Copy link
Author

tcables commented Jul 19, 2024

It seems what I described was somehow coincidental. When binding to just the default network interface, it will work most of the time for my aspnet core app. But randomly it will still fail to getaddrinfo.

as another example, i use npx iisexpress-proxy http://ct-2.localhost:62114 to http://192.168.1.170:9003 and it works all morning. then after some random amount of time, maybe after a few stops and restarts of the aspnet core website i will receive

Error: getaddrinfo ENOTFOUND ct-2.localhost
    at GetAddrInfoReqWrap.onlookupall [as oncomplete] (node:dns:120:26) {
  errno: -3008,
  code: 'ENOTFOUND',
  syscall: 'getaddrinfo',
  hostname: 'ct-2.localhost'
}

so i will ctrl-c kill the iisexpress-proxy and then run the iisexpress-proxy again.

command output:

 npx iisexpress-proxy http://ct-2.localhost:62114 to http://192.168.1.170:9003
{
  _: [
    'C:\\Program Files\\nodejs\\node.exe',
    'C:\\Users\\xxxxx\\AppData\\Roaming\\npm\\node_modules\\iisexpress-proxy\\index.js',
    'http://ct-2.localhost:62114',
    'to',
    'http://192.168.1.170:9003'
  ]
}
IIS Express Proxy 1.7.13
Proxying http://ct-2.localhost:62114 to network interfaces:
        Ethernet: http://192.168.1.170:9003
Listening... [press Control-C to exit]

netstat -ab:

 [svchost.exe]
  TCP    0.0.0.0:5357           DESKTOP-O2AMMS3:0      LISTENING
 Can not obtain ownership information
  TCP    0.0.0.0:5948           DESKTOP-O2AMMS3:0      LISTENING
 [BASupSrvc.exe]
  TCP    0.0.0.0:8080           DESKTOP-O2AMMS3:0      LISTENING
 [com.docker.backend.exe]
  TCP    0.0.0.0:9001           DESKTOP-O2AMMS3:0      LISTENING
 [node.exe]
  TCP    0.0.0.0:28198          DESKTOP-O2AMMS3:0      LISTENING
 [StreamDeck.exe]
  TCP    0.0.0.0:33060          DESKTOP-O2AMMS3:0      LISTENING
 [mysqld.exe]
  TCP    0.0.0.0:49664          DESKTOP-O2AMMS3:0      LISTENING

it didn't bind to 9003.

EDIT:

I also tried to just increment the port

npx iisexpress-proxy http://ct-2.localhost:62114 to http://192.168.1.170:9004
{
 _: [
   'C:\\Program Files\\nodejs\\node.exe',
   'C:\\Users\\xxx\\AppData\\Roaming\\npm\\node_modules\\iisexpress-proxy\\index.js',
   'http://ct-2.localhost:62114',
   'to',
   'http://192.168.1.170:9004'
 ]
}
IIS Express Proxy 1.7.13
Proxying http://ct-2.localhost:62114 to network interfaces:
       Ethernet: http://192.168.1.170:9004
Listening... [press Control-C to exit]
(node:36152) [DEP0060] DeprecationWarning: The `util._extend` API is deprecated. Please use Object.assign() instead.
(Use `node --trace-deprecation ...` to show where the warning was created)

and again it does not bind to port 9004. But then DOES NOT produce the error.

a reboot fixes all of this.

Do you have a suggestion of what could cause this?

P.S. I really appreciate the work you have done here, it saves me so much time when demoing my project changes to my boss and QA team.

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

1 participant