Ionic serve - 404 when accessing the server - ionic-framework

I have a nodejs server and ionic client.
When I run my server with "node ." and go to http://localhost:3000/#/login everything works fine.
When I run my client with "ionic server" the application loads in my browser and I see my login screen, but when I enter the details and click login I see in my chrome debug console :
I notices that the same happens for any button that needs to send a request to the server.
I tried adding <allow-navigation href="*"> to my config.xml and it didn't help, also tried to play with the ip and port with no luck.
Any idea how I can solve this?

Related

redirection is happening in ionic serve but not on device

I am launching external url on a button click by using window.location.replace
Login(){
window.location.replace("https://localdomain.com");
}
In ionic serve, after the click it redirects to "https://localdomain.com/uaa/login" and letting me to Login with corresponding cookies & header info coming as expected.
But if the same is tried in mobile i.e. after the apk build and opened in the device.
After the click, It shows below instead of redirecting to /uaa/login. so if understand correctly, redirection is not handled by default in ionic's webview? if so how to handle it?
I see the below console log from device inspect when above error comes.
Failed to load resource: the server responded with a status of 401 () /favicon.ico:1
There is no problem with inappbrowser. The back end server of the URL I'm loading in inappbrowser is having error in the logs. Resolved after fixing them

Ionic 3, HTTP native vs. HttpClient

I am struggling to make HTTP native or HttpClient get to work for my app.
If I run ionic serve -c I get HttpClient working good on my browser at localhost:8100 and in Ionic Dev App. If I build for Android though, HttpClient fails thus I decided to give HTTP Native a try.
Then I don't understand how I could get some console log if that native plugin is not supported from Ionic Dev App (here says), neither I can see on my browser cause of Cordova is not present.
Is there a way to log on a device to debug HTTP Native?
You should debug your application connect your phone to your laptop and
Open your Google Chrome Browser
Go to Inspect (Ctrl + Shift +I)
Go To More Tools enter image description here
Open Remote devices and inspect your device
For more information click here
Thanks
You wont see native http calls log to the browser since they are called native from the device and never are called from the browser, but if you are debugging while connected to xcode, the xcode debugging output should give some information about your native HTTP calls success and failure.
Following #vd_virani answer, here is a quick link to inspect a device from Chrome
chrome://inspect/#devices
Plug your device via USB, then copy & paste this link in your Chrome address bar like a website.

Ionic 3. Unable to load page via devApp

I'm a first time using Ionic 3 framework to create cross-mobile native application.
I had some problem when I test program with devApp application.
On browser it runs well, but on mobile shows error:
Unable to load page. The request time out.
Does somebody know how to solve this problem?
This could be triggered by so many reasons like bad code, network issues and so on
So I suggest you to:
Close your Devapp completly
Disconnect from Wifi
Close App in your browser
do a fresh new ionic serve -c
Start DevApp again
Connect to Wifi again
Start your App on Device
If this doesnt work you need to show us your code from app.component.ts and index.html and also your ionic info
Ionic devApp connects to your app using device internal ip on the same router. It might change everytime you connect.
Find the internal ip (ubuntu: ifconfig -a) and manually enter the ip and port using the option manually enter address in the sidebar.

ionic app url found localhost instead file folder

After generating Android build and inspect within Google chrome.
The url in app should be file:///android_asset/www/index.html (Image2)
But always getting localhost.
Why its showing localhost:8080 …?? (image1)
The url in app should be file:///android_asset/www/index.html
But its running in localhost://8080
yes, Ionic always getting node(npm) as a localhost server

$authWithOAuthPopup flow ending up in auth.firebase.com/blank/page.html

I'm trying to authorize app-users via google in an ionic app based on angularfire. The complete flow is working fine on my workstation's chrome browser (using ionic serve) but fails when deploying on my android device:
$authWithOAuthPopup, when used on Android (via 'ionic run', i.e. installed as apk) results in browser getting stuck in auth.firebase.com/blank/page.html.
All is working fine in html (via 'ionic serve') so I assume, that firebase and google configuration are fine. cordova.js is included properly.
The cordova inapp browser is installed and can open other urls. I have whitelisted firebase(io) and google domains and also allowed everything else. I am using cordova-plugin-inappbrowser 1.0.2-dev "InAppBrowser" and
cordova-plugin-whitelist 1.0.0 "Whitelist". I have tried older versions of the inappbrowser as well.
I am not using ionic livereload to avoid any potential cross-domain/proxy issues
When remote debugging, no errors are being reported: after $authWithOAuthPopup control gets lost somewhere deep in the minified firebase.js code and never returns to angularfire level
The following traffic is generated (detailed urls below):
1) firebase code calls auth.firebase.com/v2//auth/google, 2) accounts.google.com returns to 3)auth.firebase.com/v2.... which transfers to 4) auth.firebase.com/blank/page.html.
On the blank page I can see cookies.
Thanks for any advice in advance...
Detailed URLs from the webflow:
Initiator: firebase.js:147:
https: //auth.firebase.com/v2/gastrohub/auth/google?&v=js-2.2.6&transport=redirect&suppress_status_codes=true&requestId=p2k757pm4hsjv5531z7045voxcyuelsi0wt3&redirectTo=https%3A%2F%2Fauth.firebase.com%2Fblank%2Fpage.html
https: //accounts.google.com/o/oauth2/auth?response_type=code&redirect_uri=https%3A%2F%2Fauth.firebase.com%2Fv2%2Fgastrohub%2Fauth%2Fgoogle%2Fcallback&scope=%20profile&state=%7B%22firebase%22%3A%22gastrohub%22%2C%22requestId%22%3A%22p2k757pm4hsjv5531z7045voxcyuelsi0wt3%22%2C%22redirectTo%22%3A%22https%3A%2F%2Fauth.firebase.com%2Fblank%2Fpage.html%22%2C%22transport%22%3A%22redirect%22%2C%22v%22%3A%22js-2.2.6%22%7D&client_id=434498505800-p5rjvl6basvlsf4fh3t1ta9ej4pt2i28.apps.googleusercontent.com
https: //auth.firebase.com/v2/gastrohub/auth/google/callback?state=%7B%22firebase%22:%22gastrohub%22,%22requestId%22:%22p2k757pm4hsjv5531z7045voxcyuelsi0wt3%22,%22redirectTo%22:%22https://auth.firebase.com/blank/page.html%22,%22transport%22:%22redirect%22,%22v%22:%22js-2.2.6%22%7D&code=4/vgz4uJ8SgIswewKQHcMiXZbwddU_F9llfWKaRfEhOMI
https: //auth.firebase.com/blank/page.html