commandbox host updater question

Hey,
so watched brad’s video on this module: https://www.ortussolutions.com/blog/easy-custom-site-host-names-with-commandbox
and read the forgebox page on this module: ForgeBox: CommandBox Host Updater

followed the instructions…started commandBox as admin
then cd’d into the directory of the created server
then typed server start host=foo.local port=80

when the server started, it did add the host entry and also the server.json entry:

{
“app”:{
“libDirs”:“C:/cbJars/”,
“cfengine”:“adobe@11”
},
“name”:“apiPostgres”,
“web”:{
“rewrites”:{
“enable”:true
},
“host”:“api.local”,
“http”:{
“port”:“80”
}
},
“cfconfigfile”:“C:/cfconfig/myAPIPostgresLocal.json”,
“post”:“80”
}

however, when the site came up in the browser, it used the api.local name, but it was api.local:portNbr not just api.local.

I figure I did something slightly wrong in setup so thought i’d check to see what that might have been…

any thoughts?

thanks
Dan

Sorry, I’m not following what the problem is. CommandBox always uses the port number when opening your browser. Now, most browsers tend to hide port 80 since it’s unnecessary, but if port 80 is up there in the address bar and you don’t want it there, just remove it :slight_smile: The host updater module doesn’t make any change to the default manner that CommandBox opens the browser window. (I suppose it’s possible that it could FWIW but that’s not how it currently works)

Hey,
in your recording https://www.ortussolutions.com/blog/easy-custom-site-host-names-with-commandbox you showed how to use a host name without a port number in the url string…think it was site.local.
I followed what you did plus read what was on the forgebox site for the host updater module, but when i spin up my commandbox site instead of getting a host name, i get hostname:portnumber

http://api.local:57508/

i expected to get http://api.local

api local is setup in my host file because of the module…I have a feeling I am just a bit off on some setting.

in the first post above, i copied in my server.json file so you can see the settings being used.

here is the line in my host file:
127.127.0.1 api.local # CommandBox: Server B882AB3A9F5A2CC803E9B6CBCAD85B15 2018-09-17 11:05:51

everything seems to be right, i spun up commandbox as an admin (on windows 10), ran the commands you used in your video/or the same ones from the forgebox page…

server start host=myproject.local port=80

just not sure why it is not just giving me the host name without the port number attached....

thanks
Dan 

Ah, ok. So in your initial E-mail you reported that the port number showed in the URL and you didn’t want it to. But what you failed to mention is that the port that showed wasn’t the port you had set! That’s a big difference.

So, there’s like a 98% chance you have IIS or Apache (or Skype) running on port 80 and the server failed to bind so it picked a random port for you. Do a –debug start and you’ll likely see that exact message in the output. Use netstat to see what process is using the port.

https://commandbox.ortusbooks.com/embedded-server/debugging-server-starts#debug-logging

well since I am using IIS, that would probably be it…and yeah looks like port 80 is in use.

So, can you specify a different localhost port for 127.127.0.1 to run on? like 8085 and still get the host name to run, or can it only be on port 80?

I know I am soooooooo close to getting commandbox to work how Trip would like it…using the host name instead of 127.0.0.1:65754 is i think the last step…and i know i am close.

thanks
dan

so IIS was running on that port…i turned off iis and ran the server start host=api.local port=80, and it came up in the browser as http://api.local
so as i mentioned in the previous post, can this work on a different port than 80 or what?
thanks
Dan

IIS by default is greedy and listens to ALL IPs on the machine on port 80.

image.png

The fix is easy-- configure your listeners so IIS only listens to port 80 on specific IPs. That will free up all the other IPs in the 127.127 range that the hostupdater module uses to also listen to port 80 as well. You can have more than one processing bind to the same port so long as they are binding on separate IP address.

Set IIS specifically to listen on 127.0.0.1 if you’re just hitting it locally, or bind IIS to your LAN IP if this box needs routed to externally over the network.

cool…figured i was close…i did google setting iis to a different port, but this is a better way to go…set it to work on 127.0.0.1…sweet all good.
if this works, next i’ll be looking into docker/commandbox/and more, but this is a huge help.

dan