Code Monkey home page Code Monkey logo

Comments (14)

mevdschee avatar mevdschee commented on May 13, 2024

I don't know what is wrong, but in line 1822 the script does call:

header('Access-Control-Allow-Origin: *');

Can you try to be more specific? What call is failing? Is there a pre-flight request failing?

from php-crud-api.

mevdschee avatar mevdschee commented on May 13, 2024

Did you see the angular2 client example in the "examples" folder? Does that work for you?

from php-crud-api.

freddiefish avatar freddiefish commented on May 13, 2024

Good idea to first check how CORS behave with the angular2 example. When I run the api with sqlite, I get:
EXCEPTION: SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data

from php-crud-api.

mevdschee avatar mevdschee commented on May 13, 2024

Use a tool like postman (https://www.getpostman.com/) to check the output of the API. Maybe you are missing a dependency and is it showing an error. Also try F12 and use "developer tools" to debug the requests made using the "Net" tab.

from php-crud-api.

freddiefish avatar freddiefish commented on May 13, 2024

The CORS issue is resolved when I comment out line 1822
header('Access-Control-Allow-Origin: *');
Uncommenting returns the CORS warning.

from php-crud-api.

mevdschee avatar mevdschee commented on May 13, 2024

Can you provide more details as this is opposite to what I expect (and experience). How can I reproduce the CORS warning?

For the SQLite problem I created another issue (#57).

from php-crud-api.

mevdschee avatar mevdschee commented on May 13, 2024

I need to know more things, like:

  • operating system
  • php version
  • mysql version
  • url requested
  • response headers
  • response body

from php-crud-api.

mevdschee avatar mevdschee commented on May 13, 2024

Closed due to inactivity.

from php-crud-api.

freddiefish avatar freddiefish commented on May 13, 2024

Maurits

Ik heb geen tijd gehad om dit te bekijken voor jou. Wat ik vermoed: mijn domein aanvaardt via htaccess (tijdelijk ;) ) * hosts. Misschien dat de extra header call vanuit het crud php script conflicteert?
====[translated by mevdschee]====
I had no time to look at this for you. I suspect that my domain (temporarily ;-) ) accepts * hosts via htaccess. Maybe that the extra call from the crud php script is conflicting with that?

Groeten
Frederik

On 14 apr. 2016, at 13:34, Maurits van der Schee [email protected] wrote:

Can you provide more details as this is opposite to what I expect (and experience). How can I reproduce the CORS warning?

For the SQLite problem I created another issue.


You are receiving this because you authored the thread.
Reply to this email directly or view it on GitHub #55 (comment)

from php-crud-api.

mevdschee avatar mevdschee commented on May 13, 2024

Hi Frederik,

That could very well be the problem. Maybe you can try disabling that in the htaccess and see what happens? It is possibly an environment issue.

Kind regards,

Maurits

from php-crud-api.

freddiefish avatar freddiefish commented on May 13, 2024

Maurits, commenting out the Header add Access-Control-Allow-Origin "*" line in htaccess solved it!

from php-crud-api.

mevdschee avatar mevdschee commented on May 13, 2024

Great.. thank you, can you also retry #57?

from php-crud-api.

pottertech avatar pottertech commented on May 13, 2024

About the new CORS feature..., I am assuming the "*" means ALL origins are allowed? Also would like to know the format for supporting multiple origins... do we place with in a list separated by commas? example: http://website-one.com, https://website-two.com

from php-crud-api.

mevdschee avatar mevdschee commented on May 13, 2024

@pottertech Yes that should work. See: c467f98

from php-crud-api.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.