v2.5.2
Giriş yap

Cors Hatası - Cors'un Standart Protokolü

ynswtf
1,215 defa görüntülendi

Merhaba, Rest API ile server-side'dan client-side'a bilgi almam gerekiyor. Ancak şu cors durumuna takıldım. Bir zamanlar halletmiştim bu olayı ama notlarımı bulamıyorum. Şimdi de öyle bir anda tıkandım ve standart protokolü uygulamama rağmen Cors hatası vermeye devam ediyor.

Server Side greencheap.net

Client Side localhost:8000

Client'den giden istekdeki bilgiler şudur:

let http = this.$http.get(urlParam , 
    {
        params:parameter,
        headers: {
            'Content-Type':'application/x-www-form-urlencoded',
            'Accept': 'application/x-www-form-urlencoded',
        }
    }
).catch((err)=>{
    this.$notify(err.status+' '+this.$trans(err.bodyText) , 'danger')
})

Server'dan yanıt

$this->response = new Response();
$this->response->headers->set('Content-Length' , 1728000);
$this->response->headers->set('Content-Type' , 'application/x-www-form-urlencoded');
$this->response->headers->set('Access-Control-Allow-Origin' , '*');
$this->response->headers->set('Access-Control-Allow-Methods' , 'GET');
$this->response->headers->set('Access-Control-Allow-Headers' , 'Content-Type, Accept');
$this->response->headers->set('Access-Control-Max-Age' , 1728000);

Bu şekilde istek attıyorum ama Cors veriyor yinede

tayfunerbilen
1452 gün önce

bu cors çok illet bir şey ya.. php tarafında kullandığınız sınıf nedir bilmiyorum ancak zaten Access-Control-Allow-Origin tanımlanmış gibi. Sunucu tarafında https://enable-cors.org/server.html buradaki adımlardan birisi uygulanabilir belki.