dativebase / old-pyramid

Online Linguistic Database (OLD)
http://www.onlinelinguisticdatabase.org/
8 stars 2 forks source link

Problem: forms search fails in DativeV1 Chrome (CORS issue) #58

Closed jrwdunham closed 2 years ago

jrwdunham commented 2 years ago

Problem

Dative v. 1 is failing to perform searches across forms (in some browsers and some versions) because it uses the non-standard SEARCH HTTP method and this violates the CORS rules. See investigation section below.

Acceptance Criteria

Investigation

This is the error text from the browser console in Chrome:

Access to XMLHttpRequest at 'https://app.onlinelinguisticdatabase.org/blaold/forms'
from origin 'https://app.dative.ca' has been blocked by CORS policy:
Method SEARCH is not allowed by Access-Control-Allow-Methods in preflight response.

It does not appear that we can fix this in the OLD REST API. The OLD already returns SEARCH in the Access-Control-Allow-Methods list.

Dative v. 1 is using the non-standard HTTP method SEARCH. It should use the POST method for this endpoint that is provided, but it does not. Unfortunately, we can't really fix Dative v. 1 because its CoffeeScript source is too old.

Error in Chrome

forms-search-error-chrome-cors

Chrome Ignores SEARCH Method in Preflight Response

forms-search-failure-chrome-allow-methods-headers

Firefox Recognizes SEARCH Method in Preflight Response

forms-search-success-firefox-allow-methods-headers
jrwdunham commented 2 years ago

I am closing this issue. I have investigated and documented it. I do not believe it can be fixed in OLD-Pyramid or Dative v. 1. I have made a note in the relevant issue for Dative v. 2 for how we can sidestep it there.