0

I have a windows system with;

cordova 7.0.1
ionic 3.3.0
npm 3.10.8
gulp 3.9.1

I am trying to configure Ionic Serve to localhost and not the 0.0.0.0 default as it returns an Access Denied error. In a previous version I was able to add

"ank": "...",
"versionCheck": 1413143560174,
"ionicServeAddress": "localhost"

to the ionic config.file but that seems to not do anything. In addition i have tried doing ionic address to change it but that does not appear to be an option.

Is there a way to configure the default address without adding it in the ionic serve command?

EDIT .ionic/config.json

{
  "ank": "...",
  "versionCheck": 1413143560174,
  "ionicServeAddress": "localhost",
  "lastCommand": "2017-06-05T22:15:31.825Z",
  "urls": {
    "api": "https://api.ionic.io",
    "dash": "https://apps.ionic.io"
  },
  "user": {},
  "tokens": {
    "appUser": {},
    "telemetry": "afac6034-bb58-4e95-9f1f-035a90625f05"
  },
  "cliFlags": {
    "confirm": false,
    "interactive": true,
    "telemetry": true,
    "yarn": false,
    "timeout": true
  }
}

I have a gulp task which runs

ionic serve

Basic flow of the gulp serve command

deploy:watch (start)
clean:dest
preproccess (various)
gulp-notify: Generate bundle.js
copy: (various)
watch: (various)
deploy:watch (finish)
serve
Starting server: --port=8100 --p=8100 --livereload-port=35729 --r=35729 --address=0.0.0.0
DoctorWizard
  • 303
  • 1
  • 3
  • 11
  • Access denied would probably come from the use of a "privileged" port (usually < 1024, like 80 or 443) rather than the address you bind to. Try using a port well above that. But is the access denied error actually related to the socket at all? Please share the relevant part of the error logs, as well as you command line and any relevant parts of your configuration. – jcaron Jun 05 '17 at 22:51
  • the port im using is the default so 8100 but the question was not how to get around the access denied page, it was to switch the address to localhost without adding any arguments into the command line. I am able to get to the site by going to my localhost:8100 and not 0.0.0.0:8100, so I just want to change my default page to localhost – DoctorWizard Jun 06 '17 at 17:02
  • You can't "go to 0.0.0.0". `0.0.0.0` is not a real address, it's meant as a wildcard address and means that it will accept connections on any interface, rather than only on the loopback interface. If you set the address you listen on to `0.0.0.0`, you should be able to connect by going to either `localhost`, `127.0.0.1` (which are the same), or the IP address of any of your interfaces. You will even be able to connect from a different computer (on the same network at least). – jcaron Jun 06 '17 at 17:06
  • If ionic starts a browser with the `0.0.0.0` address then there's definitely something wrong in your config, but you'll probably have to give us more details of that configuration... – jcaron Jun 06 '17 at 17:08
  • I added the .ionic/config.json and the command that is being run. Is there more that should be provided? – DoctorWizard Jun 06 '17 at 17:25
  • What actually happens when you run `ionic serve`, probably. – jcaron Jun 06 '17 at 17:26
  • And possibly any relevant logs when you run it. – jcaron Jun 06 '17 at 17:27
  • Added the flow of what happens in the gulp serve process. Basically it builds it to a mapped js, then copies it, then starts the process for serving. The process works as expected if i add the --address=localhost command explicitly to the task, but a different developer may want to change this setting and shouldn't need to worry about having a local copy of the tasks so i would rather not do that if at all possible. – DoctorWizard Jun 06 '17 at 19:04

0 Answers0