diff --git a/lib/Server.js b/lib/Server.js index f2ca75a7ff..fc9bc71f18 100644 --- a/lib/Server.js +++ b/lib/Server.js @@ -189,7 +189,10 @@ function Server(compiler, options) { historyApiFallback: function() { if(options.historyApiFallback) { // Fall back to /index.html if nothing else matches. - app.use(historyApiFallback(typeof options.historyApiFallback === 'object' ? options.historyApiFallback : null)); + var historyApiFallbackOptions = typeof options.historyApiFallback === 'object' ? options.historyApiFallback : {}; + // If publicPath is set then fallback to publicPath (where there would be index.html) + if (!historyApiFallbackOptions.index && options.publicPath) historyApiFallbackOptions.index = options.publicPath; + app.use(historyApiFallback(historyApiFallbackOptions)); } },