Welcome! Log In Create A New Profile

Advanced

CORS Engeli

Posted by Emsanator 
CORS Engeli
June 26, 2018 02:53AM
Merhaba,

Yeni kurulan Nginx sunucumda bir türlü CORS engelini gecemiyorum. İlgili alan adina ait .conf dosyasinda birçok değişiklik yapmama rağmen hala tarayıcının konsolunda "Reason: CORS header ‘Access-Control-Allow-Origin’ missing" uyarisi almaktayim.

Alan adi bilgisi şu şekilde;

https://assets.example.com -> Arayüz dosyalarının bulunduğu konum
https://example.com -> Site içeriği

Aşağida size alan adinin konfikasyon dosyasini paylaşıyorum.

server {

listen 80;
server_name example.com www.example.com;
charset utf-8;

access_log /usr/share/nginx/html/erisim.log;
error_log /usr/share/nginx/html/hata.log;
rewrite_log on;

client_max_body_size 1000M;
root /usr/share/nginx/html;
index index.php index.html index.htm;


location / {

set $cors "";

if ($http_origin ~* (https?://[^/]*\.example\.com(:[0-9]+)?)) {
set $cors "true";
}

if ($cors = "true") {
add_header 'Access-Control-Allow-Origin' "$http_origin";
}


if (!-e $request_filename){
rewrite ^/(.+)$ /index.php?id=$1 last;
}
}

# PHP FPM configuration.
location ~* \.php$ {
fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;
fastcgi_index index.php;
fastcgi_split_path_info ^(.+\.php)(.*)$;
include /etc/nginx/fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}

error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}

# We don't need .ht files with nginx.
location ~ /\.ht {
deny all;
}

}


Nerede hata yaptığımı belirtebilirsiniz?
Şimdiden teşekkür ederim.
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 236
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready