Commit Graph

282 Commits (9cd378521d1130a7aea27ccba91ac139a095bb6d)

Author SHA1 Message Date
Tim Raymond b4d10754e4 Force prefixing in several locations
The Basepath option should be applied in anything that will be consumed
by the React application. This is because from its perspective, the
proxy sitting between it and the backend wants those prefixes regardless
of what it does with them before handing the request back to the
Chronograf backend. Consequently, there's situations in the backend
where we need to have the `opts.Basepath` or the `basepath` that we
alter when `opts.PrefixRoutes` is set. The `basepath` is strictly for
altering routing decisions made by the backend.

There's subtle places where routes are supplied to the frontend that
need to always have the `opts.Basepath` set as well. Another commit
addressed the "Location" header of Redirects, for example.
2017-05-08 14:40:50 -07:00
Tim Raymond 49feb39e90 Add PrefixedRedirect function
The router that we use has a feature that will automatically redirect
routes in certain situations where it feels a trailing slash would be
appropriate. Because the underlying router is totally unaware of
upstream prefixing activity, the "Location" that it sends clients to is
incorrect because it doesn't have the prefix.

This introduces a middleware that catches any downstream 3XX class
responses and replaces the Location header with the prefixed version of
it, plus a trailing slash. It does this only when the prefix has not
been applied already by some downstream middleware.
2017-05-08 14:40:50 -07:00
Tim Raymond ee5760bfd3 Add HTTP status code to logs
This adds the status code to the response log message to make it easier
to diagnose issues. It also replaces the placeholder "Success" message
with the decoded value of the HTTP Status, resulting in messages like:

INFO[0041] Response: Temporary Redirect                  code=307

...and so on. Both easily consumable by humans and machines.
2017-05-08 14:40:50 -07:00
Tim Raymond 0141f0870c Use Basepath over string concatenation
Basepath was previously not working here because the strings constructed
via concatenation had a trailing slash at the end:

Before:
  rootPath => "/someprefix/chronograf/v1/"

After:
  rootPath => "/someprefix/chronograf/v1"

The julienschmidt/httprouter that the bouk/httprouter is based on has
support for ignoring trailing slashes, which is behavior that we want.
However, routing decisions involving this rootPath string were being
made by a `strings.HasPrefix` function. This conditional seeks to
apply the token middleware only in cases where routes _under_
`/chronograf/v1` are accessed (e.g. `/chronograf/v1/sources`). In cases
where the paths were effectively equal, this conditional accidentally
worked because the string `/chronograf/v1` does not have the prefix
`/chronograf/v1/`. When this was corrected to use `path.Join`, this case
became true and caused the token middleware to be applied.

`path.Join` is the correct way to construct paths, since this prevents
issues where a fragment like `/foo/` is concatenated with a fragment
like `/bar/quux/` to yield the string `/foo//bar/quux/`.

Given that continuing to use concatenation is no longer an option, the
solution is to compare the lengths of the strings to ensure that the
path under comparison is longer than the prefix it's being tested
against. This guarantees that the subject path is a route underneath the
`/chronograf/v1` route.
2017-05-08 14:40:50 -07:00
Tim Raymond 93acebffc6 Remove broken path.Join logic
It is entirely unclear why this doesn't work.
2017-05-08 14:40:50 -07:00
Tim Raymond & Jared Scheib dcbe44d9ce Fix OAuth when using Basepath
Updated the logout link in the UI to use a link provided by the
/chronograf/v1/ endpoint. We also replaced many instances of string
concatenation of URL paths with path.Join, which better handles cases
where prefixed and suffixed "/" characters may be present in provided
basepaths. We also refactored how Basepath was being prefixed when using
Auth. Documentation was also updated to warn users that basepaths should
be applied to the OAuth callback link when configuring OAuth with their
provider.
2017-05-08 14:40:50 -07:00
Tim Raymond 43ee0e4baf Add logging of response times
This makes monitoring Chronograf 👍
2017-05-08 14:40:50 -07:00
Jared Scheib 1e2e3c1362 Notify user about --prefix-routes when using --basepath 2017-05-08 14:40:50 -07:00
Chris Goller 243286892f Fix null queryConfig and add substantial test coverage to kapacitor
storage
2017-05-05 16:14:02 -05:00
Chris Goller 3821b1ccff Update Kapacitor alerts to set queryConfig to null if not parsable. 2017-05-05 14:30:20 -05:00
Andrew Watkins 92bd5d10b4 Resolve conflicts
Conflicts:
	ui/src/utils/influxql.js
2017-05-05 10:01:26 -07:00
Chris Goller 365434783d Merge branch 'master' into feature/influx-write 2017-05-05 08:10:14 -05:00
Chris Goller e54554e8de Update influxql AST parsing to return full binary exprs (#1380) 2017-05-03 15:57:19 -07:00
Chris Goller 7b08acb621 Add line-protocol /write endpoint to all data sources 2017-05-03 00:06:40 -05:00
Chris Goller bc1ac4c0ce Update swagger.json to mention queryConfig's range 2017-05-02 15:20:06 -05:00
Chris Goller 7a577f6618 Add Range.Lower and Range.Upper to query config to persist custom ranges 2017-05-02 15:08:51 -05:00
Chris Goller f8652efdee Update /queries endpoint to handle templates 2017-04-28 15:12:28 -05:00
Luke Morris b9327c412e Remove unused dependencies from dashboard_test.go 2017-04-28 12:57:16 -07:00
Hunter Trujillo 116c2e3c23 Merge branch 'master' into feature/template-variables
# Conflicts:
#	bolt/internal/internal.pb.go
#	ui/src/CheckSources.js
#	ui/src/dashboards/actions/index.js
#	ui/src/dashboards/containers/DashboardPage.js
#	ui/src/data_explorer/components/Visualization.js
#	ui/src/shared/components/AutoRefresh.js
#	ui/src/shared/components/Dropdown.js
2017-04-25 17:08:55 -06:00
Jade McGough 32386f8ab2 make kapacitor patching work 2017-04-21 12:42:35 -07:00
Jade McGough cbdf067a56 persist the currently active kapacitor in boltdb 2017-04-21 12:42:35 -07:00
Jade McGough 05688ef634 WIP 2017-04-21 12:39:41 -07:00
Jade McGough 26bb911e04 add kapacitors to AllRoutes 2017-04-21 12:39:41 -07:00
Jade McGough 8d9ac52c5c clean up kapacitor swagger docs 2017-04-21 12:39:40 -07:00
Chris Goller ff176164c1 Remove extra debug info in the dashboard testing 2017-04-20 16:31:00 -05:00
Chris Goller d45a1ae7f4 Add measurements and databases to template variables 2017-04-20 14:32:02 -05:00
Chris Goller 5f54d9282c Update templates API response 2017-04-20 12:22:55 -05:00
Chris Goller adb67657c3 Add more validation checks to dashboard updates 2017-04-20 11:47:31 -05:00
Chris Goller 2018f7300a Add initial template CRUD operations 2017-04-20 11:09:56 -05:00
Chris Goller c141709451 Move dashboard cells into cells.go 2017-04-20 09:24:57 -05:00
Chris Goller 673a0c07c0 Add swagger documentation for template variables 2017-04-19 12:09:22 -05:00
Chris Goller f4361c6c9a Merge branch 'master' into feature/refreshing-jwts 2017-04-17 15:24:10 -05:00
Chris Goller 45e9508d31 Update oauth2 Authenticator signatures to use extend 2017-04-17 11:49:45 -05:00
Chris Goller 1fabed5039 Update tests for refreshing jwts 2017-04-14 02:35:30 -05:00
Chris Goller 5b692bdef3 Add JWT refresh on validation.
JWTs will only life five minutes into the future.  Any time
the server receives an authenicated request, the JWT's expire at
will be extended into the future.
2017-04-14 02:12:52 -05:00
Andrew Watkins dc4574fa39 Add default RP to queryConfig when no RP is present
This will only happen if the qC is fully qualified.  A fully
qualified query is one that has a db, measurement, and field.
2017-04-13 17:49:53 -07:00
Andrew Watkins 1271ade90d Merge pull request #1232 from influxdata/feature/voltron-the-builder
Voltron the builder / One Builder to Rule Them All / Make Builder Great Again
2017-04-13 09:49:45 -07:00
Chris Goller 16a202ce8c Merge branch 'master' into feature/reverse-kapa 2017-04-11 12:52:49 -05:00
Fred Cox b804be1885 Fix env var name for Google client secret 2017-04-11 16:48:35 +03:00
Hunter Trujillo 8eb6aae21b Use backend IDs for great justice. 2017-04-10 12:02:09 -06:00
Chris Goller 313f7e94ca Update rawtext in queryconfig to be null and not omitempty 2017-04-07 17:32:10 -05:00
Chris Goller 01b2842ea8 Update queries endpoint to return InfluxQL, queryConfig, queryAST 2017-04-07 16:58:56 -05:00
Chris Goller 40e0f579f1 Fix JSON typos in swagger.json 2017-04-07 16:35:05 -05:00
Chris Goller d2c7c74238 Merge branch 'master' into feature/structured-queries
Conflicts:
	Godeps
	LICENSE_OF_DEPENDENCIES.md
	server/mux.go
	server/routes.go
	ui/.eslintrc
2017-04-07 16:06:24 -05:00
Chris Goller 6de8ec26d5 Merge branch 'master' into feature/generic-oauth 2017-04-07 15:35:28 -05:00
Chris Goller ca58111730 Fix PathEscape work for go 1.7 2017-04-07 15:32:35 -05:00
Chris Goller 5d2aced125 Update generic oauth routes to be path escaped. 2017-04-07 15:20:53 -05:00
Chris Goller bbf6c1300c Add configurable scopes to generic oauth2 support 2017-04-07 14:58:35 -05:00
Chris Goller de43145701 Merge branch 'master' into feature/generic-oauth 2017-04-07 08:39:52 -05:00
John Gilden cf054c1f79 Use the Host header from the original Kapacitor URL 2017-04-07 08:15:19 -05:00