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

CORS impossible? How to get around D8's lack of support for pre-flight OPTIONS request #3

Open
rjcorwin opened this issue May 15, 2015 · 5 comments

Comments

@rjcorwin
Copy link

Hi @enzolutions -
When doing Update operations on Models, Does backbone.drupal get around this rest-critical issue somehow? If it does, I can't seem to get it working locally.

\ RJ

@enzolutions
Copy link
Owner

Hi @rjsteinert the update project must to be implemented using PATCH request, but for some reason is failing, I didn't have time to find the problem.

If you can debug the information send and what drupal 8 Rest Patch expect that could be useful and I can apply any necessary change.

I have plan to implement a new Rest in Drupal 8 called Relaxed Webservice https://www.drupal.org/project/relaxed

@rjcorwin
Copy link
Author

If you can debug the information send and what drupal 8 Rest Patch expect that could be useful and I can apply any necessary change.

I think we are stuck until that D8 critical gets fixed, browsers enforce doing a pre-flight OPTIONS request before doing a PATCH request. So, no OPTIONS support in Drupal REST means we can't do PATCH requests CORS. I tried some hacky stuff to get around the pre-flight but no luck.

I have plan to implement a new Rest in Drupal 8 called Relaxed Webservice

Relaxed! I looooove the CouchDB reference in the logo. I ultimately crave a JS library similar to jquery.couch.js. Functions like saveDoc and login without having to learn the idiosyncrasies of Drupal's REST implementation. Tyler Frankenstein has been working on a JS library called jDrupal that is similar to jquery.couch.js. I wonder if you two should join forces.

jDrupal + Relaxed = Happy Front End Developers?

@enzolutions
Copy link
Owner

Hi @rjsteinert actually is OPTIONS could be skiped using the .htacess changes I put in Readme options.

About what is the change necessary to apply in PATCH call I didn't determine yet what is wrong for that reason I need help, but you had a point when you said maybe we have to wait until Drupal 8 get released.

In have plans to implement in this project Drupal MarionetteJS Generator integration with Relaxed to implement offline first, so in my mind yes that means Happy Front End Developers.

@rjcorwin
Copy link
Author

I have done a couple of projects with PouchDB for offline apps. Are you thinking that as a user browses a an App connected to Drupal that it stores every Entity requested from Drupal in a Pouch database so that when the Browser goes offline that the data is still there?

@enzolutions
Copy link
Owner

My idea is fetch what is necessary to work offline and user will be able to add new record in their local environment for personal information imagine a contact list, that only affect you own universe could be perfect offline first.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants