Gulp – Handle page reload in gulp-connect using connect-history-api-fallback

Page reload doesn’t work after enabled the html5mode. We have to rewrite the url and it could be easily done by using a middleware for the connect server.


var connect            = require('gulp-connect');
var historyApiFallback = require('connect-history-api-fallback');

gulp.task('connect', function() {
    middleware: function(connect, opt) {
      return [ historyApiFallback({}) ];


Done =)

Reference: GitHub – bripkens/connect-history-api-fallback


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.