node.js - Why can't I connect to a connect-served site over web sharing? -
i'm using grunt, connect, , livereload serve test page (it's single flat html page) during development, , want test site on phone. using web sharing—by navigating site using mac's local url (my-imac.local
).
when serve page using python's simplehttpserver, works fine. when use grunt/connect, it's inaccessible there (though it's still accessible @ localhost). how connect configured respond these requests?
my gruntfile, reference:
var path = require('path'); var lrsnippet = require('grunt-contrib-livereload/lib/utils').livereloadsnippet; var foldermount = function foldermount(connect, point) { return connect.static(path.resolve(point)); }; module.exports = function(grunt) { function registerrobusttasks(name, tasks) { grunt.registertask(name, function() { // don't have stupid issues grunt crashing // every time test fails... grunt.option('force', true); grunt.task.run(tasks); }); } grunt.initconfig({ pkg : grunt.file.readjson('package.json'), livereload : { port : 48341 }, connect : { livereload : { options : { port : 48342, middleware : function(connect, options) { return [lrsnippet, foldermount(connect, '.')]; } } } }, regarde : { html : { files : ['*.html'], tasks : ['livereload'] } } }); grunt.loadnpmtasks('grunt-regarde'); grunt.loadnpmtasks('grunt-contrib-livereload'); grunt.loadnpmtasks('grunt-contrib-connect'); registerrobusttasks('default', ['livereload-start', 'connect', 'regarde']); };
turns out simple: needed hostname : '*'
option on connect server.
Comments
Post a Comment