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

Implement/better warning for url length #6773

Merged
merged 13 commits into from
Apr 27, 2016

Conversation

spalger
Copy link
Contributor

@spalger spalger commented Apr 4, 2016

Fixes #6531
Fixes #6790

This change warns the user when they are about to overflow the maximum url length supported by their browser, and then renders a url-overflow specific error page once they do.

Things to note:

  • Tried and failed to find a single place where this could be detected as it's happening, instead defined the max length ahead of time.
  • Tried and failed to find a way to "feature detect" the url length limit, had to resort to user-agent matching.
  • The limits are not configurable
  • Limits:
    • IE/Edge, 2,000 characters
    • All other browsers 25,000

`,
},
'url:limit': {
value: 2082,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Weren't we seeing IE fail before this point? I thought 2048 was the magic number there...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We were testing the length of the hash, I think... I trust the support doc though.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, right, that's the whole URL length... alrighty then.

@w33ble
Copy link
Contributor

w33ble commented Apr 6, 2016

I get the error when I hit the hard upper limit, but I only see it in the console, not at the top of Kibana:

screenshot 2016-04-05 17 03 41

screenshot 2016-04-05 17 03 36

Seems like I should see a red error bar at the top too - perhaps it's not being caught properly?

@spalger
Copy link
Contributor Author

spalger commented Apr 6, 2016

Yeah, perhaps we should just fatal 😕

@w33ble
Copy link
Contributor

w33ble commented Apr 6, 2016

I think just showing the error message on the screen would be good enough really. As long as the user knows why something isn't happening, that's really the goal here.

throw new TypeError(`
  The URL has gotten too big and kibana can no longer
  continue. Please refresh to return to your previous state.
`);

Maybe a notify.error instead, or in addition?

@w33ble w33ble assigned spalger and unassigned w33ble Apr 6, 2016
@spalger
Copy link
Contributor Author

spalger commented Apr 6, 2016

I took a stab at a custom error handler/route that displays the URL and gives tips for fixing the problem. Thoughts?
2016-04-06 07_35_21

@w33ble
Copy link
Contributor

w33ble commented Apr 6, 2016

@spalger I like that, and I like that it links to the parts of Kibana that you can use to get the issue fixed.

This is looking good, but I'd get some additional input on the wording on the error page. I like it though.

<h3>Tips</h3>
<ul>
<li>
Saved objects can sometimes persist some unexpectedly large values that get put into the url when they load. You may be able to edit these saved objects in the <a href="#/settings/objects">"objects" section of the settings app</a>.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@palecur could you help us with wording here?

@rashidkpc
Copy link
Contributor

rashidkpc commented Apr 14, 2016

I'm concerned that this will trigger often in browsers that do not have the URL size limit. I'm usually completely against browser specific behaviors, but in this case I would like us to handle IE specifically and ask the user to reduce the size of the dashboard using another browser, informing them that IE in particular is problematic.

Otherwise we're going to throw this warning at a huge number of users who don't need to take any action, and make them go into the big scary advanced settings list to fix it.

@spalger spalger assigned rashidkpc and unassigned spalger Apr 26, 2016
@spalger
Copy link
Contributor Author

spalger commented Apr 26, 2016

Reworded the description, removed the unused config default, and responded to questions inline

@rashidkpc rashidkpc assigned spalger and unassigned rashidkpc Apr 27, 2016
@rashidkpc
Copy link
Contributor

@spalger couple small changes and this is GTG

@spalger spalger merged commit d2b758e into elastic:master Apr 27, 2016
This was referenced Apr 27, 2016
elastic-jasper added a commit that referenced this pull request Apr 27, 2016
---------

**Commit 1:**
[state] add configurable warning level based on url length

* Original sha: 55db90d
* Authored by spalger <spalger@users.noreply.github.com> on 2016-04-04T21:57:45Z

**Commit 2:**
[state] add a hard length limit that will start throwing errors

* Original sha: 64699aa
* Authored by spalger <spalger@users.noreply.github.com> on 2016-04-04T22:14:06Z

**Commit 3:**
Merge branch 'master' of github.com:elastic/kibana into implement/betterWarningForUrlLength

* Original sha: 4c70d69
* Authored by spalger <spalger@users.noreply.github.com> on 2016-04-06T07:05:47Z

**Commit 4:**
[dashboard] cleanup quietly to prevent error

* Original sha: 1dace5c
* Authored by spalger <spalger@users.noreply.github.com> on 2016-04-06T08:50:55Z

**Commit 5:**
[errorview] add url overflow display

* Original sha: 8b4ebf5
* Authored by spalger <spalger@users.noreply.github.com> on 2016-04-06T08:51:47Z

**Commit 6:**
[errorview] persist the overflow url so that refresh works

* Original sha: e308db9
* Authored by spalger <spalger@users.noreply.github.com> on 2016-04-06T09:05:13Z

**Commit 7:**
Merge branch 'master' of github.com:elastic/kibana into implement/betterWarningForUrlLength

* Original sha: 121e4f2
* Authored by spalger <email@spalger.com> on 2016-04-15T18:49:12Z

**Commit 8:**
[config] remove url limit config, it should adapt automatically

* Original sha: 281b38b
* Authored by spalger <email@spalger.com> on 2016-04-15T23:38:05Z

**Commit 9:**
[chrome] rework url overflow detection

The previous version of this pr relied on the State service to catch times when the URL would grow out of control. While overflows will commonly occur in the State service, this didn't handle urls that were navigated to using a link. They worked because the state service would eventually be called, but the failure was unexpected and required interaction to trigger.

This new approach does the checking at a higher level, in the chrome.

We also removed the `url:limit` configuration value in favor of browser detection (I was not able to find or come up with a way to quietly and quickly feature detect this). The new limits are 2000 characters for IE and 25000 for all other browsers.

* Original sha: 116521c
* Authored by spalger <email@spalger.com> on 2016-04-15T23:40:18Z

**Commit 10:**
Merge branch 'master' of github.com:elastic/kibana into implement/betterWarningForUrlLength

* Original sha: aa030d7
* Authored by spalger <email@spalger.com> on 2016-04-26T16:51:22Z

**Commit 11:**
[ui/config] remove unused default

* Original sha: b333c51
* Authored by spalger <email@spalger.com> on 2016-04-26T16:52:29Z

**Commit 12:**
Merge branch 'master' of github.com:elastic/kibana into implement/betterWarningForUrlLength

* Original sha: 133d7e5
* Authored by spalger <email@spalger.com> on 2016-04-27T23:17:44Z

**Commit 13:**
[urlOverflow] assign magic numbers to variables

* Original sha: 8b97881
* Authored by spalger <email@spalger.com> on 2016-04-27T23:24:17Z
elastic-jasper added a commit that referenced this pull request Apr 27, 2016
---------

**Commit 1:**
[state] add configurable warning level based on url length

* Original sha: 55db90d
* Authored by spalger <spalger@users.noreply.github.com> on 2016-04-04T21:57:45Z

**Commit 2:**
[state] add a hard length limit that will start throwing errors

* Original sha: 64699aa
* Authored by spalger <spalger@users.noreply.github.com> on 2016-04-04T22:14:06Z

**Commit 3:**
Merge branch 'master' of github.com:elastic/kibana into implement/betterWarningForUrlLength

* Original sha: 4c70d69
* Authored by spalger <spalger@users.noreply.github.com> on 2016-04-06T07:05:47Z

**Commit 4:**
[dashboard] cleanup quietly to prevent error

* Original sha: 1dace5c
* Authored by spalger <spalger@users.noreply.github.com> on 2016-04-06T08:50:55Z

**Commit 5:**
[errorview] add url overflow display

* Original sha: 8b4ebf5
* Authored by spalger <spalger@users.noreply.github.com> on 2016-04-06T08:51:47Z

**Commit 6:**
[errorview] persist the overflow url so that refresh works

* Original sha: e308db9
* Authored by spalger <spalger@users.noreply.github.com> on 2016-04-06T09:05:13Z

**Commit 7:**
Merge branch 'master' of github.com:elastic/kibana into implement/betterWarningForUrlLength

* Original sha: 121e4f2
* Authored by spalger <email@spalger.com> on 2016-04-15T18:49:12Z

**Commit 8:**
[config] remove url limit config, it should adapt automatically

* Original sha: 281b38b
* Authored by spalger <email@spalger.com> on 2016-04-15T23:38:05Z

**Commit 9:**
[chrome] rework url overflow detection

The previous version of this pr relied on the State service to catch times when the URL would grow out of control. While overflows will commonly occur in the State service, this didn't handle urls that were navigated to using a link. They worked because the state service would eventually be called, but the failure was unexpected and required interaction to trigger.

This new approach does the checking at a higher level, in the chrome.

We also removed the `url:limit` configuration value in favor of browser detection (I was not able to find or come up with a way to quietly and quickly feature detect this). The new limits are 2000 characters for IE and 25000 for all other browsers.

* Original sha: 116521c
* Authored by spalger <email@spalger.com> on 2016-04-15T23:40:18Z

**Commit 10:**
Merge branch 'master' of github.com:elastic/kibana into implement/betterWarningForUrlLength

* Original sha: aa030d7
* Authored by spalger <email@spalger.com> on 2016-04-26T16:51:22Z

**Commit 11:**
[ui/config] remove unused default

* Original sha: b333c51
* Authored by spalger <email@spalger.com> on 2016-04-26T16:52:29Z

**Commit 12:**
Merge branch 'master' of github.com:elastic/kibana into implement/betterWarningForUrlLength

* Original sha: 133d7e5
* Authored by spalger <email@spalger.com> on 2016-04-27T23:17:44Z

**Commit 13:**
[urlOverflow] assign magic numbers to variables

* Original sha: 8b97881
* Authored by spalger <email@spalger.com> on 2016-04-27T23:24:17Z
@epixa epixa added v4.5.2 and removed v4.5.1 labels May 14, 2016
@epixa epixa removed the v4.5.2 label Jun 6, 2016
epixa added a commit that referenced this pull request Aug 15, 2016
---------

**Commit 1:**
[state] add configurable warning level based on url length

* Original sha: 55db90d
* Authored by spalger <spalger@users.noreply.github.com> on 2016-04-04T21:57:45Z

**Commit 2:**
[state] add a hard length limit that will start throwing errors

* Original sha: 64699aa
* Authored by spalger <spalger@users.noreply.github.com> on 2016-04-04T22:14:06Z

**Commit 3:**
Merge branch 'master' of github.com:elastic/kibana into implement/betterWarningForUrlLength

* Original sha: 4c70d69
* Authored by spalger <spalger@users.noreply.github.com> on 2016-04-06T07:05:47Z

**Commit 4:**
[dashboard] cleanup quietly to prevent error

* Original sha: 1dace5c
* Authored by spalger <spalger@users.noreply.github.com> on 2016-04-06T08:50:55Z

**Commit 5:**
[errorview] add url overflow display

* Original sha: 8b4ebf5
* Authored by spalger <spalger@users.noreply.github.com> on 2016-04-06T08:51:47Z

**Commit 6:**
[errorview] persist the overflow url so that refresh works

* Original sha: e308db9
* Authored by spalger <spalger@users.noreply.github.com> on 2016-04-06T09:05:13Z

**Commit 7:**
Merge branch 'master' of github.com:elastic/kibana into implement/betterWarningForUrlLength

* Original sha: 121e4f2
* Authored by spalger <email@spalger.com> on 2016-04-15T18:49:12Z

**Commit 8:**
[config] remove url limit config, it should adapt automatically

* Original sha: 281b38b
* Authored by spalger <email@spalger.com> on 2016-04-15T23:38:05Z

**Commit 9:**
[chrome] rework url overflow detection

The previous version of this pr relied on the State service to catch times when the URL would grow out of control. While overflows will commonly occur in the State service, this didn't handle urls that were navigated to using a link. They worked because the state service would eventually be called, but the failure was unexpected and required interaction to trigger.

This new approach does the checking at a higher level, in the chrome.

We also removed the `url:limit` configuration value in favor of browser detection (I was not able to find or come up with a way to quietly and quickly feature detect this). The new limits are 2000 characters for IE and 25000 for all other browsers.

* Original sha: 116521c
* Authored by spalger <email@spalger.com> on 2016-04-15T23:40:18Z

**Commit 10:**
Merge branch 'master' of github.com:elastic/kibana into implement/betterWarningForUrlLength

* Original sha: aa030d7
* Authored by spalger <email@spalger.com> on 2016-04-26T16:51:22Z

**Commit 11:**
[ui/config] remove unused default

* Original sha: b333c51
* Authored by spalger <email@spalger.com> on 2016-04-26T16:52:29Z

**Commit 12:**
Merge branch 'master' of github.com:elastic/kibana into implement/betterWarningForUrlLength

* Original sha: 133d7e5
* Authored by spalger <email@spalger.com> on 2016-04-27T23:17:44Z

**Commit 13:**
[urlOverflow] assign magic numbers to variables

* Original sha: 8b97881
* Authored by spalger <email@spalger.com> on 2016-04-27T23:24:17Z
epixa added a commit that referenced this pull request Aug 17, 2016
---------

**Commit 1:**
[state] add configurable warning level based on url length

* Original sha: 55db90d
* Authored by spalger <spalger@users.noreply.github.com> on 2016-04-04T21:57:45Z

**Commit 2:**
[state] add a hard length limit that will start throwing errors

* Original sha: 64699aa
* Authored by spalger <spalger@users.noreply.github.com> on 2016-04-04T22:14:06Z

**Commit 3:**
Merge branch 'master' of github.com:elastic/kibana into implement/betterWarningForUrlLength

* Original sha: 4c70d69
* Authored by spalger <spalger@users.noreply.github.com> on 2016-04-06T07:05:47Z

**Commit 4:**
[dashboard] cleanup quietly to prevent error

* Original sha: 1dace5c
* Authored by spalger <spalger@users.noreply.github.com> on 2016-04-06T08:50:55Z

**Commit 5:**
[errorview] add url overflow display

* Original sha: 8b4ebf5
* Authored by spalger <spalger@users.noreply.github.com> on 2016-04-06T08:51:47Z

**Commit 6:**
[errorview] persist the overflow url so that refresh works

* Original sha: e308db9
* Authored by spalger <spalger@users.noreply.github.com> on 2016-04-06T09:05:13Z

**Commit 7:**
Merge branch 'master' of github.com:elastic/kibana into implement/betterWarningForUrlLength

* Original sha: 121e4f2
* Authored by spalger <email@spalger.com> on 2016-04-15T18:49:12Z

**Commit 8:**
[config] remove url limit config, it should adapt automatically

* Original sha: 281b38b
* Authored by spalger <email@spalger.com> on 2016-04-15T23:38:05Z

**Commit 9:**
[chrome] rework url overflow detection

The previous version of this pr relied on the State service to catch times when the URL would grow out of control. While overflows will commonly occur in the State service, this didn't handle urls that were navigated to using a link. They worked because the state service would eventually be called, but the failure was unexpected and required interaction to trigger.

This new approach does the checking at a higher level, in the chrome.

We also removed the `url:limit` configuration value in favor of browser detection (I was not able to find or come up with a way to quietly and quickly feature detect this). The new limits are 2000 characters for IE and 25000 for all other browsers.

* Original sha: 116521c
* Authored by spalger <email@spalger.com> on 2016-04-15T23:40:18Z

**Commit 10:**
Merge branch 'master' of github.com:elastic/kibana into implement/betterWarningForUrlLength

* Original sha: aa030d7
* Authored by spalger <email@spalger.com> on 2016-04-26T16:51:22Z

**Commit 11:**
[ui/config] remove unused default

* Original sha: b333c51
* Authored by spalger <email@spalger.com> on 2016-04-26T16:52:29Z

**Commit 12:**
Merge branch 'master' of github.com:elastic/kibana into implement/betterWarningForUrlLength

* Original sha: 133d7e5
* Authored by spalger <email@spalger.com> on 2016-04-27T23:17:44Z

**Commit 13:**
[urlOverflow] assign magic numbers to variables

* Original sha: 8b97881
* Authored by spalger <email@spalger.com> on 2016-04-27T23:24:17Z
epixa added a commit that referenced this pull request Aug 18, 2016
---------

**Commit 1:**
[state] add configurable warning level based on url length

* Original sha: 55db90d
* Authored by spalger <spalger@users.noreply.github.com> on 2016-04-04T21:57:45Z

**Commit 2:**
[state] add a hard length limit that will start throwing errors

* Original sha: 64699aa
* Authored by spalger <spalger@users.noreply.github.com> on 2016-04-04T22:14:06Z

**Commit 3:**
Merge branch 'master' of github.com:elastic/kibana into implement/betterWarningForUrlLength

* Original sha: 4c70d69
* Authored by spalger <spalger@users.noreply.github.com> on 2016-04-06T07:05:47Z

**Commit 4:**
[dashboard] cleanup quietly to prevent error

* Original sha: 1dace5c
* Authored by spalger <spalger@users.noreply.github.com> on 2016-04-06T08:50:55Z

**Commit 5:**
[errorview] add url overflow display

* Original sha: 8b4ebf5
* Authored by spalger <spalger@users.noreply.github.com> on 2016-04-06T08:51:47Z

**Commit 6:**
[errorview] persist the overflow url so that refresh works

* Original sha: e308db9
* Authored by spalger <spalger@users.noreply.github.com> on 2016-04-06T09:05:13Z

**Commit 7:**
Merge branch 'master' of github.com:elastic/kibana into implement/betterWarningForUrlLength

* Original sha: 121e4f2
* Authored by spalger <email@spalger.com> on 2016-04-15T18:49:12Z

**Commit 8:**
[config] remove url limit config, it should adapt automatically

* Original sha: 281b38b
* Authored by spalger <email@spalger.com> on 2016-04-15T23:38:05Z

**Commit 9:**
[chrome] rework url overflow detection

The previous version of this pr relied on the State service to catch times when the URL would grow out of control. While overflows will commonly occur in the State service, this didn't handle urls that were navigated to using a link. They worked because the state service would eventually be called, but the failure was unexpected and required interaction to trigger.

This new approach does the checking at a higher level, in the chrome.

We also removed the `url:limit` configuration value in favor of browser detection (I was not able to find or come up with a way to quietly and quickly feature detect this). The new limits are 2000 characters for IE and 25000 for all other browsers.

* Original sha: 116521c
* Authored by spalger <email@spalger.com> on 2016-04-15T23:40:18Z

**Commit 10:**
Merge branch 'master' of github.com:elastic/kibana into implement/betterWarningForUrlLength

* Original sha: aa030d7
* Authored by spalger <email@spalger.com> on 2016-04-26T16:51:22Z

**Commit 11:**
[ui/config] remove unused default

* Original sha: b333c51
* Authored by spalger <email@spalger.com> on 2016-04-26T16:52:29Z

**Commit 12:**
Merge branch 'master' of github.com:elastic/kibana into implement/betterWarningForUrlLength

* Original sha: 133d7e5
* Authored by spalger <email@spalger.com> on 2016-04-27T23:17:44Z

**Commit 13:**
[urlOverflow] assign magic numbers to variables

* Original sha: 8b97881
* Authored by spalger <email@spalger.com> on 2016-04-27T23:24:17Z
epixa added a commit that referenced this pull request Aug 19, 2016
[backport] PR #6773 to 4.x - IE length warning
@mrjameshamilton
Copy link

Our users have also come across this and changing browsers is not always possible. It would be better to fix this properly by not using the URL to save the state.

@w33ble
Copy link
Contributor

w33ble commented Dec 11, 2017

@mrjameshamilton In Kibana 5.0.0 and later, you can enable state:storeInSessionStorage to remove application state from the URL completely. Enabling this will allow you to use very complex dashboards with IE without any issues. See #8022 for more details.

@spalger spalger deleted the implement/betterWarningForUrlLength branch October 18, 2019 17:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants