Project

General

Profile

Actions

Bug #6748

closed

rrd_fetch_json.php returns html when user is unauthorized (causes "Error: SyntaxError: Unexpected token <")

Added by Stephen Smith about 8 years ago. Updated over 5 years ago.

Status:
Resolved
Priority:
Normal
Assignee:
Jared Dillard
Category:
Status_Monitoring
Target version:
Start date:
08/29/2016
Due date:
% Done:

0%

Estimated time:
Plus Target Version:
Affected Version:
2.3.2
Affected Plus Version:
Affected Architecture:

Description

The rrd_fetch_json.php endpoint should always return json, as it normally is being requested by js or something that intends to parse it.

When the user's session expires (or if the user is unauthorized), this endpoint returns the html for the login page, causing the js that tries to parse it to error out.

To reproduce:
1. Go to status monitoring
2. Wait for the session to expire (or log out in a separate tab)
3. Press reload on the graph
4. ???
5. "Error: SyntaxError: Unexpected token <"

The endpoint should return some kind of json formatted error message, which the js can parse and either display an appropriate message or redirect the whole page to login.

Actions #1

Updated by Jim Thompson about 8 years ago

  • Assignee set to Jared Dillard
  • Target version set to 2.4.0
Actions #2

Updated by Jared Dillard almost 8 years ago

  • Status changed from New to Feedback

I added a better error message in the case that JSON doesn't get returned, but a hint for the user to check that they have an active session.

Actions #3

Updated by Jim Pingle over 7 years ago

  • Status changed from Feedback to Assigned

This works nicely for Status > Monitoring, a similar error happens on the traffic graph widget and Status > Traffic graphs comes back blank (no graph, no error, nothing in the display).

Feel free to close this if those should be in a separate ticket, but it's all very similar.

Actions #4

Updated by Kill Bill over 7 years ago

SyntaxError: Unexpected token < in JSON at position 0
    at JSON.parse (<anonymous>)
    at Object.uo (d3.min.js:3)
    at XMLHttpRequest.i (d3.min.js:1)

The user is perfectly authorized, keep getting this right after login on the dashboard.

Actions #5

Updated by Renato Botelho about 7 years ago

  • Target version changed from 2.4.0 to 2.4.1
Actions #6

Updated by Jim Pingle about 7 years ago

  • Target version changed from 2.4.1 to 2.4.2
Actions #7

Updated by Jim Pingle about 7 years ago

  • Status changed from Assigned to Resolved
  • Target version changed from 2.4.2 to 2.4.1

This has already been fixed on 2.4.1

Actions #8

Updated by Jim Pingle over 5 years ago

  • Project changed from pfSense to pfSense Packages
  • Category changed from 118 to Status_Monitoring
Actions

Also available in: Atom PDF