[ZBX-8459] Zabbix API doesn't support OPTION request when API client does CORS Created: 2014 Jul 09  Updated: 2017 May 30  Resolved: 2014 Jul 10

Status: Closed
Project: ZABBIX BUGS AND ISSUES
Component/s: API (A)
Affects Version/s: 2.2.4
Fix Version/s: 2.3.3

Type: Incident report Priority: Trivial
Reporter: Erwin Vrolijk Assignee: Unassigned
Resolution: Fixed Votes: 0
Labels: api, javascript
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

firefox 30+


Attachments: HTML File api.html    
Issue Links:
Duplicate
is duplicated by ZBXNEXT-1377 Make api_jsonrpc.php allow cross-site... Closed

 Description   

When accessing the api throug javascript form another domain the client does an HTTP OPTION request to determine the CORS rules on the server the API is running on.
SInce this request has the wrong content type a 412 error code is returned by the API.

Please allow OPTION requests with all content types so the zabbix API can be access through javascript hosted on another domain than the API.



 Comments   
Comment by Pavels Jelisejevs (Inactive) [ 2014 Jul 10 ]

A related issue - ZBXNEXT-1377.

Comment by Andrejs Čirkovs (Inactive) [ 2014 Jul 10 ]

Test file; please open it pointing to Zabbix API entry point like:

file:///home/andrew/Work/localhost/api.html?zabbix=http://zabbix.dev/dev/ZBX-8459/frontends/php/api_jsonrpc.php

Comment by Andrejs Čirkovs (Inactive) [ 2014 Jul 10 ]

RESOLVED in development branch svn://svn.zabbix.com/branches/dev/ZBX-8459 r47178.

Comment by Oleg Egorov (Inactive) [ 2014 Jul 11 ]

(1) String changes?

andrewtch RESOLVED, none.

oleg.egorov CLOSED

Comment by Oleg Egorov (Inactive) [ 2014 Jul 11 ]

(2) Coding style:

if($_SERVER['REQUEST_METHOD'] == 'OPTIONS') {
	return;
}
  • Add space after IF
  • Use strict comparison

andrewtch RESOLVED in r47253.

oleg.egorov CLOSED

Comment by Oleg Egorov (Inactive) [ 2014 Jul 11 ]

TESTED

Comment by Andrejs Čirkovs (Inactive) [ 2014 Jul 11 ]

CLOSED, fixed in pre-2.3.3 r47261.

Generated at Sat Apr 20 07:26:37 EEST 2024 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.