0

I've managed to reach internal localhost:8100 (where ionic server lives) from an external device accessing to 192.168.1.130/ionic with a proxypass. My http-vhosts.conf:

<VirtualHost *:80>
    ServerAdmin localhost@admin
    DocumentRoot "/Volumes/DATA/03-www"
    ServerName localhost

    <Directory "/Volumes/DATA/03-www">
        AllowOverride All
        Require all granted
    </Directory>

    ProxyPreserveHost On
    ProxyPass /ionic http://localhost:8100
    ProxyPassReverse /ionic http://localhost:8100
</VirtualHost>

The problem here is that only the first request (index.html) is made to the ionic server. Next requests comming from this index.html are made to the apache, as the path is not including /ionic at the beginning:

::1 - - [26/May/2015:21:00:31 +0200] "GET /ionic HTTP/1.1" 200 3097
::1 - - [26/May/2015:21:00:31 +0200] "GET /lib/ionic/css/ionic.css HTTP/1.1" 404 1265
::1 - - [26/May/2015:21:00:31 +0200] "GET /css/style.css HTTP/1.1" 404 1265
::1 - - [26/May/2015:21:00:31 +0200] "GET /fonts/font-awesome/css/font-awesome.min.css HTTP/1.1" 404 1265

Is there a way to force all requests that where originated from specific path (that matches proxypass) to go via proxy, without having to modify index.html?

Miquel
  • 8,339
  • 11
  • 59
  • 82

2 Answers2

0

Do you have a specific reason to do like this ? Because if not and you only needs to check your app on a device there are few other alternatives.

1 - PhoneGap Developer app

You can install this in your device (ex: IPhone) and as long as your phone and development machine (the one running ionic server) in the same network, you could connect (with out a cable)

2 - Ionic View

When you want to leverage the full native functionality, you could publish your app to ionic platform and download in an install it to Ionic View

3 - Ripple Emulator

A chrome extension that will allow test you app in the browser. it supports functionalists such as GeoLocation

HTH

sameera207
  • 16,547
  • 19
  • 87
  • 152
  • Thanks, yes, I know those alternatives. I would like to do like this to do fast testing of the app in device viewer, without having to compile the app and upload to the device. Thanks anyway, I'll take a look again to phonegap developer app which I think is the fastest one of the proposed alternatives – Miquel May 27 '15 at 07:46
  • In phonegap app it happens the same as in ionic: it's not possible to connect to mac 192.168.1.130:3000 or 192.158.1.130:8100 – Miquel May 27 '15 at 11:31
  • Ok, it was a problem of adding node to mac firewall – Miquel May 27 '15 at 11:48
0

Try to add the slash at the proxy pass, actually in my configuration the following first rule works well

ProxyPass /ionic/ http://localhost:8100

In your configuration you can try this then:

<VirtualHost *:80>
ServerAdmin localhost@admin
DocumentRoot "/Volumes/DATA/03-www"
ServerName localhost

<Directory "/Volumes/DATA/03-www">
    AllowOverride All
    Require all granted
</Directory>

ProxyPreserveHost On
ProxyPass /ionic/ http://localhost:8100
ProxyPassReverse /ionic/ http://localhost:8100

Mok
  • 35
  • 4