`ReverseProxy read error` when serving `index.html` from `/public`
- Dominant language
- Go
- Stars
- 1.2k
- Forks
- 58
- Avg merge
- 1d 2h
- Merged PRs (30d)
- 6
Description
I'm having an issue when attempting to serve a file from the Rails public folder when using kamal with thruster.
I have a javascript library that requires me to copy assets to the Rails public folder so it can be accessed via the code. The path is: `https://tools-demo.passtesting.com/webviewer/ui/index.html,` but I get a 5xx error when attempting to access it.
When tailing the proxy logs (`kamal proxy logs`) I see a 301 response and then: `httputil: ReverseProxy read error during body copy: unexpected EOF`
When I access it as a directory (`https://tools-demo.passtesting.com/webviewer/ui/`) it loads as expected. The problem is that the library has a hardcoded reference to index.html instead of referring to the path, so I currently have no way to mitigate this.
The problem appears to be solved when I disable X-Sendfile (`X_SENDFILE_ENABLED=false`).
Ideally I'd like to keep this enabled for all of its other benefits, but is fully disabling X-Sendfile the only solution here?
Contributor guide
Research direction
Reproduce the request to /webviewer/ui/index.html while serving the asset from Rails' public folder, then compare proxy logs with X_SENDFILE_ENABLED=true and false. Investigate the ReverseProxy read error and 301 response; done means the file loads without a 5xx or unexpected EOF while X-Sendfile remains enabled.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go, rails
- Domain
- backend, infrastructure
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 52/100