Skip to content

Applying middleware.StaticWithConfig to echo.Group always results in 404 #2923

@ivan-avalos

Description

@ivan-avalos

I'm applying the StaticWithConfig middleware to a group and it always returns 404, am I doing anything wrong? It seems to work if I apply directly to e instead of to the group.

e.Pre(middleware.Rewrite(map[string]string{"/": "/app"}))

app := e.Group("/app")
app.Use(middleware.StaticWithConfig(middleware.StaticConfig{
	IgnoreBase: true,
	HTML5:      true,
	Root:      "../client/out",
	Index:      "index.html",
}))

auth := e.Group("/api")
// ...
$ ls -la ../client/out
avalos@macmini server % ls -la ../client/out
...
-rw-r--r--   1 avalos  staff  11914 Mar 21 23:22 index.html
...

Thanks in advance.

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