[Bug]
bitbucket90 opened this issue · 1 comments
General
- I have updated to the latest version of MySpeed.
- My bug has not been reported yet.
The Bug
MySpeed Bug Report: 404 Error When Accessing /myspeed
Summary
When accessing the MySpeed application through a Caddy reverse proxy, requests to the /myspeed path result in a 404 (Not Found) error or could not reach the API of this instance error, However, the backend service is accessible and returns the expected content when queried directly.
Environment
- Caddy Version: v2.8.4
- MySpeed Version: Used proxmox installer, but believe its latest stable release
- Operating System: 6.8.12-1-pve Debian 12 Lx
- Browser: Firefox 130.0, Chrome/Edge 128.0.0.0
Steps to Reproduce
- Set up Caddy as a reverse proxy for the MySpeed application.
- Configure Caddy to forward /myspeed/* requests to the MySpeed backend.
- Start the MySpeed backend service.
- Access https://example.com/myspeed in a web browser.
- Observe the 404 error.
Expected Behavior
Accessing https://example.com/myspeed should display the MySpeed application interface.
Actual Behavior
Accessing https://example.com/myspeed returns a 404 (Not Found) error. OR I get an API error stating
Configuration
Caddyfile
{
admin 127.0.0.1:2019
debug
}
:80 {
redir https://{host}{uri} permanent
}
example.com {
root * /var/www/example.com
file_server
handle_path /myspeed/* {
reverse_proxy backend-service:5216 {
header_up Host {http.request.host}
header_up X-Real-IP {http.request.remote.host}
header_up X-Forwarded-For {http.request.remote.host}
header_up X-Forwarded-Proto {http.request.scheme}
}
}
handle /manifest.json {
reverse_proxy backend-service:5216
}
handle /assets/* {
reverse_proxy backend-service:5216
}
encode gzip zstd
log {
output file /var/log/caddy/access.log
format json
level DEBUG
}
}
Log Analysis
-
Caddy logs show 404 errors for /myspeed requests:
{"level":"debug","msg":"fileserver.(*FileServer).notFound: HTTP 404","request":{"method":"GET","host":"example.com","uri":"/myspeed","headers":{"Accept":["*/*"],"User-Agent":["curl/7.88.1"]},"tls":{"resumed":false,"version":772,"cipher_suite":4865,"proto":"h2","server_name":"example.com"}},"status":404}
-
Direct requests to the backend service succeed:
HTTP/1.1 200 OK Accept-Ranges: bytes Cache-Control: public, max-age=0 Last-Modified: Tue, 21 May 2024 22:14:31 GMT ETag: W/"40c-18f9d386958" Content-Type: text/html; charset=UTF-8 Content-Length: 1036 Connection: keep-alive Keep-Alive: timeout=5 <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8" /> <link rel="icon" href="/assets/img/favicon.ico" /> ... </head> <body> <div id="root"></div> </body> </html>
Additional Information
- The server is listening on the expected ports (80, 443, 22, 2019).
- The backend service is running and accessible when queried directly.
- Other routes on the server (e.g., the root path) are working correctly.
Possible Causes
- The /myspeed path handling in Caddy may not be correctly configured.
- There might be a mismatch between how Caddy is forwarding requests and how the MySpeed application is expecting to receive them.
- The MySpeed application may not be properly configured to work under a /myspeed path prefix.
Attempted Solutions
- Verified that the backend service is running and accessible.
- Checked Caddy configuration for any obvious misconfigurations.
- Tested direct access to the backend service to confirm it's working as expected.
Additional Notes
- The issue occurs consistently across different browsers and devices.
- The problem started after moving the MySpeed application behind the Caddy reverse proxy.
- This worked fine when myspeed was on the base url.
- The documentation on reverse proxy did not help me.
Attachments
- Full sanitized Caddy log file
- Network configuration output
- Curl test results
What device are you using to access the page?
In the browser, On mobile
Which operating system is your MySpeed instance running on?
Linux
Closed - This is not myspeed related, once I added some for X Forward rules it seemed to have worked.
` # MySpeed configuration
handle_path /myspeed* {
reverse_proxy 10.0.10.21:5216 {
header_up X-Forwarded-Prefix /myspeed
header_up Host {http.request.host}
header_up X-Real-IP {http.request.remote.host}
header_up X-Forwarded-For {http.request.remote.host}
header_up X-Forwarded-Proto {http.request.scheme}
}
}
# Handle all MySpeed related requests
handle /manifest.json {
reverse_proxy 10.0.10.21:5216
}
handle /assets/* {
reverse_proxy 10.0.10.21:5216
}
# Additional catch-all for MySpeed static files
handle {
reverse_proxy 10.0.10.21:5216 {
header_up X-Forwarded-Prefix /myspeed
}
}`