http - Getting error due to Access-Control-Allow-Origin. (NGINX) -


i using nginx , receiving error in browser's console.

according instructions of boss, need set cors did , still getting same error.

this entire error

options https://backend.just4bettors.mobi/auth/login xmlhttprequest cannot load https://backend.just4bettors.mobi/auth/login. no 'access-control-allow-origin' header present on requested resource. origin 'https://www.just4bettors.mobi' therefore not allowed access. response had http status code 400.

here config

map $http_origin $cors_header {     default "";     "~^https?://[^/]+\.just4bettors\.mobi(:[0-9]+)?$" "$http_origin";  }  server {     large_client_header_buffers 1 1k;      listen 80;     listen 443 ssl;      server_name  www.just4bettors.mobi  just4bettors.mobi;     root   /home/c0pt/capilleira/capilleiraclickandgamblemobile/www;      ssl_certificate      /etc/ssl/certs/just4bettors.mobi.chained.crt;     ssl_certificate_key  /etc/ssl/private/just4bettors.mobi.key;      ssl_session_cache    shared:ssl:1m;     ssl_session_timeout  5m;      ssl_ciphers  high:!anull:!md5;     ssl_prefer_server_ciphers  on;      location / {         add_header access-control-allow-origin $cors_header;     ...     } }    server {     listen 80;     listen 443 ssl;      server_name  backend.just4bettors.mobi  www.backend.just4bettors.mobi;      ssl_certificate      /etc/ssl/certs/just4bettors.mobi.chained.crt;     ssl_certificate_key  /etc/ssl/private/just4bettors.mobi.key;      ssl_session_cache    shared:ssl:1m;     ssl_session_timeout  5m;      ssl_ciphers  high:!anull:!md5;     ssl_prefer_server_ciphers  on;      location / {        add_header access-control-allow-origin $cors_header;     } } 

i have domain , subdomain, named cross-domain.

where have error here ? mean, have set , still asking me access-control-allow-origin, why ?

ps: want cry.

you need set header on backend side, not under main section location /

the error message states not allowed access backend www frontend.

your backend must allow backend.just4bettors.mobi , www.backend.just4bettors.mobi valid origins ...


Comments

Popular posts from this blog

javascript - AngularJS custom datepicker directive -

javascript - jQuery date picker - Disable dates after the selection from the first date picker -