I've been working with a nitrous.io virtural box, building a gulp task which incorporates browsersync.io. I've been able to install and instantiate browser-sync via gulp, but Im having trouble getting a valid proxy address.
This is a truncated version of my gulp.js file:
var gulp = require('gulp');
var browserSync = require('browser-sync');
var reload = browserSync.reload;
gulp.task('browser-sync', function () {
browserSync.init( {
server: {
baseDir: '~/workspace/www/XXXXXXX/',
proxy: 'XXXXXX-XXXXXX.euw1.nitrousbox.com:3000/XXXXXXX/',
port: 4002
}
});
});
Nitrous have been kind enough to post this demo, with live-reload: http://help.nitrous.io/setting-up-gulp-with-livereload-and-sass/ , where in they set the live-reload port to 4002 because of the way they have their ports allocated for HTTP. Regardless im getting local host addresses for browsersync that dont resolve. here is some example output:
[00:19:57] Starting 'browser-sync'...
[00:19:57] Finished 'browser-sync' after 7.4 ms
[BS] Local: >>> http://localhost:3001
[BS] External: >>> http://192.168.233.209:3001
[BS] Serving files from: ~/workspace/www/XXXXXXX/
From the above, I can see that the port isn't being honored, but regardless these address only apply to localhost type environments. Can anyone point me in the right direction?
ADDITIONS
Digging a bit further, I've read doc from nitrous http://help.nitrous.io/faq-localhost/ and thus I know a bit more about port allocation and forwarding within the box. my gulp file now looks like the following:
var gulp = require('gulp');
var browserSync = require('browser-sync');
var reload = browserSync.reload;
gulp.task('browser-sync', function () {
browserSync.init( {
server: {
baseDir: '~/workspace/www/XXXXXXX/',
proxy: '0.0.0.0:3000/XXXXXXX/',
port: 4002
}
});
});
The responce from gulp after spooling up gulp browser-sync
is the same but now if I direct the browser to XXXXXX-XXXXXX.euw1.nitrousbox.com:3001/XXXXXXX/
I get a responce Cannot GET /XXXXXXX/
which is I think coming from node. I believe this means that the browser-sync server isn't spooling up correctly.