How do I send an AJAX request header 4 cross domain access?

0 favourites
  • 4 posts
From the Asset Store
Domain/site obfuscation, very simple implementation
  • The manual states to:

    If you want AJAX requests to your server to work from any domain, or in preview, you can configure it to send the following HTTP header:

    Access-Control-Allow-Origin: *

    it is not clear to me what goes where when setting this up? This does not work.

    Parameters for AJAX: Set request header

    Header "Access-Control-Allow-Origin:*"

    Value ""

    How exactly should I be filling this out?

  • You have to set it in PHP file. The other way is to make a .htaccess file with the following content:

    <IfModule mod_headers.c>
    Header set Access-Control-Allow-Origin "*"
    </IfModule> [/code:2f9hydtn]
    
    Place this file on the server next to the file you are trying to access with AJAX.
  • thank you for your response.

    If that is the only way then why does the AJAX plugin have the "set request header" action?

    All I am after is a real example of how to do this action's parameters.

    If I understand your response then:

    Header "Access-Control-Allow-Origin"

    Value "*" should work.

    It does not.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • You have to set the header in the response from the server. So your code needs to be in your server-side code... not in Construct.

    Like this:

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