1

Send request form http://cluster.vk.araneum.dev/ to http://aggregator.vk.araneum.dev.

Erorr in browser:

XMLHttpRequest cannot load http://aggregator.vk.araneum.dev/getWidget/ultratrade. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://cluster.vk.araneum.dev' is therefore not allowed access. The response had HTTP status code 404.

Nginx config (aggregator.vk.araneum.dev):

  location / {

    root  /var/www/aggregator.araneum.dev/source/web;
    try_files $uri $uri/ /app_dev.php$is_args$args;
     autoindex on;
    index  app_dev.php;

        add_header 'Access-Control-Allow-Origin' *;
        add_header 'Access-Control-Allow-Credentials' 'true';
        add_header 'Access-Control-Allow-Methods' *;
  }

JS code:

$(function() {
    $.ajax({
        url: platformDomain+'/getWidget/ultratrade',
        success: function(responce) {
            $('#ultratrade-widget').html(responce.widgetHtml);
        }
    });
});

What's wrong ?

Khotey Vitaliy
  • 509
  • 1
  • 6
  • 18
  • http://stackoverflow.com/questions/7157393/xmlhttprequest-cannot-load - "You cannot issue requests through the XMLHttpRequest to other domains or subdomains. If you are issuing the request from www.foo.com you also need to target the request at www.foo.com and not leave out the www...." – Stanislav Baturin Jan 29 '16 at 13:11
  • `The response had HTTP status code 404`. http://nginx.org/r/add_header – Alexey Ten Jan 29 '16 at 13:21

0 Answers0