Skip to content

Commit e22317f

Browse files
coltonwSpaceK33z
authored andcommitted
Setting contentBase to false with historyApiFallback on works properly #791 (#797)
* Setting contentBase to false with historyApiFallback on works properly #791 * Remove console.log
1 parent b85a0ce commit e22317f

File tree

2 files changed

+23
-2
lines changed

2 files changed

+23
-2
lines changed

lib/Server.js

+5-2
Original file line numberDiff line numberDiff line change
@@ -318,8 +318,11 @@ function Server(compiler, options) {
318318
defaultFeatures.push("contentBaseFiles");
319319
if(options.watchContentBase)
320320
defaultFeatures.push("watchContentBase");
321-
if(options.historyApiFallback)
322-
defaultFeatures.push("historyApiFallback", "middleware", "contentBaseFiles");
321+
if(options.historyApiFallback) {
322+
defaultFeatures.push("historyApiFallback", "middleware");
323+
if(contentBase !== false)
324+
defaultFeatures.push("contentBaseFiles");
325+
}
323326
defaultFeatures.push("magicHtml");
324327
if(contentBase !== false)
325328
defaultFeatures.push("contentBaseIndex");

test/HistoryApiFallback.test.js

+18
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,24 @@ describe("HistoryApiFallback", function() {
7575
});
7676
});
7777

78+
describe("as object with contentBase set to false", function() {
79+
before(function(done) {
80+
server = helper.start(config3, {
81+
contentBase: false,
82+
historyApiFallback: {
83+
index: "/bar.html"
84+
}
85+
}, done);
86+
req = request(server.app);
87+
});
88+
89+
it("historyApiFallback should work and ignore static content", function(done) {
90+
req.get("/index.html")
91+
.accept("html")
92+
.expect(200, /In-memory file/, done);
93+
});
94+
});
95+
7896
describe("as object with contentBase and rewrites", function() {
7997
before(function(done) {
8098
server = helper.start(config2, {

0 commit comments

Comments
 (0)