Access-Control-Allow-Origin: *

0 favourites
  • 5 posts
From the Asset Store
Supports keyboard, mouse and gamepads. Supports several gamepads at once.
  • Doing some simple AJAX test stuff. It's just getting an error back and I think it's due to this access control issue. I remember this from aaaaaaages ago but I can't remember how to implement it.

    For now, I just have a one-line PHP file which just echo's 'Test' back. Where would I put the 'Access-Control-Allow-Origin: * ' in my PHP file?

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • farflamex

    Add this to the top of your PHP script:

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

    And make sure you use https for your site URL.

  • Thanks, that's that part sorted.

    I'm getting an error because it's not https, so I need to sort that. I don't like the idea of securing my entire domain because I do lots of other stuff there and I don't wanna mess other stuff up. I'll have to read about it, pretty sure I have the option for free anyway though.

  • Thanks, that's that part sorted.

    I'm getting an error because it's not https, so I need to sort that. I don't like the idea of securing my entire domain because I do lots of other stuff there and I don't wanna mess other stuff up. I'll have to read about it, pretty sure I have the option for free anyway though.

    It shouldn't affect much, you can get free SSL's aswell but if you have the option for free - go for it!

  • Excellent, had a chat with my host and they installed SSL on my site and it all works fine now, thanks for your help :)

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)