Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Serving "/" from FileServer using embedded Filesystem results in HTTP 404 #1383

Closed
mtrense opened this issue Oct 23, 2019 · 0 comments
Closed

Comments

@mtrense
Copy link

mtrense commented Oct 23, 2019

Version
v0.0.0-20191006184023-c8e73f4f4df2

Describe the bug
Following https://github.com/kataras/iris/wiki/File-server and #1283, when serving from an embedded Filesystem like

app.HandleDir("/", "./web/build", iris.DirOptions{
	Asset:      static.Asset,
	AssetInfo:  static.AssetInfo,
	AssetNames: static.AssetNames,
	Gzip: false,
})

with a file ./web/build/index.html present, requesting http://localhost:8080/ results in a HTTP 404.

To Reproduce
Steps to reproduce the behavior:

  1. Bundle an index.html using go-bindata
  2. Add route with HandleDir as described above
  3. Request http://localhost:8080/

Expected behavior
Content of index.html should be returned

Screenshots
n/a

Desktop (please complete the following information):
n/a

Additional context
While debugging I found that the Handler returned from FileServer in

f, err := fs.Open(name)
already returns with http.StatusNotFound when name is /. This works when using the filesystem, but not for the embedded filesystem. Line 355, where the special handling for the root-URL should happen is thus never reached.

@kataras kataras added this to the v12.0.0 milestone Oct 24, 2019
kataras added a commit that referenced this issue Oct 24, 2019
@kataras kataras closed this as completed Oct 26, 2019
github-actions bot pushed a commit to goproxies/github.com-kataras-iris that referenced this issue Jul 27, 2020
…necessary check. Solves kataras#1383

Former-commit-id: 1ad4535deb1c4792408a3bf63456b333aa752594
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants