ZABBIX BUGS AND ISSUES
  1. ZABBIX BUGS AND ISSUES
  2. ZBX-8459

Zabbix API doesn't support OPTION request when API client does CORS

    Details

    • Type: Incident report Incident report
    • Status: Closed
    • Priority: Trivial Trivial
    • Resolution: Fixed
    • Affects Version/s: 2.2.4
    • Fix Version/s: 2.3.3
    • Component/s: API (A)
    • Labels:
    • Environment:
      firefox 30+

      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.

      1. api.html
        1 kB
        Andrejs Čirkovs

        Issue Links

          Activity

          Hide
          Pavels Jelisejevs (Inactive) added a comment -

          A related issue - ZBXNEXT-1377.

          Show
          Pavels Jelisejevs (Inactive) added a comment - A related issue - ZBXNEXT-1377 .
          Hide
          Andrejs Čirkovs (Inactive) added a comment -
          Show
          Andrejs Čirkovs (Inactive) added a comment - 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
          Hide
          Andrejs Čirkovs (Inactive) added a comment -

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

          Show
          Andrejs Čirkovs (Inactive) added a comment - RESOLVED in development branch svn://svn.zabbix.com/branches/dev/ZBX-8459 r47178.
          Hide
          Oleg Egorov (Inactive) added a comment - - edited

          (1) String changes?

          Andrejs Čirkovs RESOLVED, none.

          Oleg Egorov CLOSED

          Show
          Oleg Egorov (Inactive) added a comment - - edited (1) String changes? Andrejs Čirkovs RESOLVED, none. Oleg Egorov CLOSED
          Hide
          Oleg Egorov (Inactive) added a comment - - edited

          (2) Coding style:

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

          Andrejs Čirkovs RESOLVED in r47253.

          Oleg Egorov CLOSED

          Show
          Oleg Egorov (Inactive) added a comment - - edited (2) Coding style: if ($_SERVER['REQUEST_METHOD'] == 'OPTIONS') { return ; } Add space after IF Use strict comparison Andrejs Čirkovs RESOLVED in r47253. Oleg Egorov CLOSED
          Hide
          Oleg Egorov (Inactive) added a comment -

          TESTED

          Show
          Oleg Egorov (Inactive) added a comment - TESTED
          Hide
          Andrejs Čirkovs (Inactive) added a comment -

          CLOSED, fixed in pre-2.3.3 r47261.

          Show
          Andrejs Čirkovs (Inactive) added a comment - CLOSED, fixed in pre-2.3.3 r47261.

            People

            • Assignee:
              Unassigned
              Reporter:
              Erwin Vrolijk
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: