Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ NOTE: As semantic versioning states all 0.y.z releases can contain breaking chan
- [#356](https://github.com/kobsio/kobs/pull/#356): [app] Fix tooltip in documents table of the klogs plugin. Fix filtering of services and operations in the Jaeger plugin. Add max height to all select boxes.
- [#358](https://github.com/kobsio/kobs/pull/#358): [app] Fix namespace handling, when multiple namespaces are selected.
- [#359](https://github.com/kobsio/kobs/pull/#359): [app] Fix pagination, when the number of items per page is changed.
- [#360](https://github.com/kobsio/kobs/pull/#360): [app] Fix static file handling, when url contains a dot (`.`).

### Changed

Expand Down
18 changes: 17 additions & 1 deletion pkg/app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,23 @@ func New(hubAddress, appAddress, appAssetsDir string) (Server, error) {
return
}

if strings.Contains(r.URL.Path, ".") {
// If the request path contains "/static/" or one of the listed extensions, we use our static handler to
// serve the files for our React app.
// The list of file extensions was generated by executing the following command in the "./bin/app" dir:
// find . -type f -name '*.*' | sed 's|.*\.||' | sort -u
if strings.Contains(r.URL.Path, "/static/") ||
strings.HasSuffix(r.URL.Path, ".css") ||
strings.HasSuffix(r.URL.Path, ".html") ||
strings.HasSuffix(r.URL.Path, ".ico") ||
strings.HasSuffix(r.URL.Path, ".jpg") ||
strings.HasSuffix(r.URL.Path, ".js") ||
strings.HasSuffix(r.URL.Path, ".json") ||
strings.HasSuffix(r.URL.Path, ".map") ||
strings.HasSuffix(r.URL.Path, ".png") ||
strings.HasSuffix(r.URL.Path, ".svg") ||
strings.HasSuffix(r.URL.Path, ".txt") ||
strings.HasSuffix(r.URL.Path, ".woff") ||
strings.HasSuffix(r.URL.Path, ".woff2") {
staticHandler.ServeHTTP(w, r)
return
}
Expand Down