question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Host flag not working with serve

See original GitHub issue

Description:

I would like to test my app in the browser in a different domain other than localhost. The documentation says I can use the --host='domain.lcl' flag but that does not work. It seems like Ionic is not passing the host to Angular CLI.

Steps to Reproduce:

New app and run ionic serve --source-map --ssl --consolelogs --devapp --host='domain.lcl'

Same problem without all flags except host

Output:

❯ npm start

> project@ start /Users/marvinheilemann/Documents/Project_name
> npm run dev

> project@ dev /Users/marvinheilemann/Documents/Project_name
> ionic serve --source-map --ssl --consolelogs --devapp --host='domain.lcl'

> ng run app:ionic-cordova-serve --host=0.0.0.0 --port=8100 --source-map --ssl --cordova-mock --consolelogs --consolelogs-port=53703
[ng] WARNING: This is a simple server for use in testing or debugging Angular applications
[ng] locally. It hasn't been reviewed for security issues.
[ng] Binding this server to an open connection can result in compromising your application

My ionic info:

Ionic:

   Ionic CLI                     : 5.2.5 (/Users/marvinheilemann/.nvm/versions/node/v10.16.0/lib/node_modules/ionic)
   Ionic Framework               : @ionic/angular 4.7.4
   @angular-devkit/build-angular : 0.802.2
   @angular-devkit/schematics    : 8.2.2
   @angular/cli                  : 8.2.2
   @ionic/angular-toolkit        : 2.0.0

Capacitor:

   Capacitor CLI   : 1.1.1
   @capacitor/core : 1.1.1

Cordova:

   Cordova CLI       : 8.1.1 (cordova-lib@8.1.0)
   Cordova Platforms : not available
   Cordova Plugins   : not available

Utility:

   cordova-res : 0.6.0
   native-run  : 0.2.8

System:

   ios-deploy : 1.9.4
   ios-sim    : 8.0.1
   NodeJS     : v10.16.0 (/Users/marvinheilemann/.nvm/versions/node/v10.16.0/bin/node)
   npm        : 6.9.0
   OS         : macOS Mojave
   Xcode      : Xcode 10.3 Build version 10G8

Other Information:

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
imhoffdcommented, Aug 21, 2019

Open a new issue. Just a warning, it’s something we probably won’t be able to fix for a while.

0reactions
muuvmuuvcommented, Aug 21, 2019

I’m getting an error now about web socket mixed content, do you know how to solve this or should I open a new issue for that? It seems like with a custom domain the --consolelog flag does not work properly. And it does not open the browser with the give --address.

Mixed Content: The page at ‘https://domain.lcl:8100/auth/login’ was loaded over HTTPS, but attempted to connect to the insecure WebSocket endpoint ‘ws://domain.lcl:53703/’. This request has been blocked; this endpoint must be available over WSS.

Read more comments on GitHub >

github_iconTop Results From Across the Web

"Invalid Host header" when running Angular/cli development ...
The --disable-host-check flag works fine if you need to run from Cloud9. I use the following command: ng serve --open --host $IP --port...
Read more >
ng serve - Angular
Option Description Value Type Default Value ‑‑hmr Enable hot module replacement. boolean false ‑‑host Host to listen on. string localhost ‑‑open Opens the url in default...
Read more >
CLI - Parcel
The parcel CLI is the most common way to use Parcel. It supports three different commands: serve, watch, and build.
Read more >
How do I Configure Flask Dev Server to be Visible Across the ...
The Problem Flask ships with a development server, ... server using the flask executable, you can use the host flag and pass the...
Read more >
API - esbuild
If you still run into cross-platform quote escaping issues with different ... You can set the host on the command line by using...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found