Skip to content

[dev server] appIndex ignored if the url is not a sub-directory of the html file #2328

@GabrielDelepine

Description

@GabrielDelepine

With the following configuration

export default {
  appIndex: "./src/index.html",
  rootDir: "./"
}

The appIndex will be ignored unless the URL starts with /src/, leading to a 404 HTTP response.

This seems to be an intentional behavior of the historyApiFallbackMiddleware (see the line 38)

I cannot see any benefits of this behavior. The actual location of the html file ./src/index.html shouldn't have anything to do with the URL pattern.

Why force a URL prefix based on the actual location of the html file?

I suggest removing the following if statement:

if (!ctx.url.startsWith(appIndexBrowserPathPrefix)) {  
    return next();
}

Am I missing something here? @LarsDenBakker

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions