Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

166
Visualizações
Facing CORS policy issue

I facing and issue Access to XMLHttpRequest at 'http://demo.equalinfotech.com/Iadiva/images/product/1634623781ladiva_barbara_01.glb' from origin 'http://localhost:8100' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.

I build a app on IONIC on that app I want to display 3D images and for 3D images I am using .glb format I am using backend as php, I am sending URL through API.

I am going to mention my code below

public function getProductDetails() {

    header("Access-Control-Allow-Origin: *");
    header("Access-Control-Allow-Headers: *");
    header("Content-Type: application/json");
    header("Access-Control-Expose-Headers: Content-Length, X-JSON");
    header("Access-Control-Allow-Headers: Content-Type, Access-Control-Allow-Headers, Authorization, X-Requested-With");

// echo "You have CORS!";

    $json_file = file_get_contents('php://input');

    $jsonvalue = json_decode($json_file, true);



    $category_id = $jsonvalue['category_id'];

    $product_id = $jsonvalue['product_id'];

    

    $APPPATH=APPPATH;

    $APPPATHArr=explode('application',$APPPATH);

    $glbURL=$APPPATHArr[0];



    $response = $this->customer->getProductDetailsNew($category_id, $product_id);



    if (!empty($response)) {

        $results['success'] = 'true';

        $results['error'] = 0;

        $results['data'] = $response;

        $results['msg'] = 'Fetched successfully';

        $results['service'] = BASE_URL . 'api/customers/getCategory';

    } else {

        $results['success'] = 'false';

        $results['error'] = 1;

        $results['data'] = [];

        $results['msg'] = 'Record Not Found';

        $results['service'] = BASE_URL . 'api/customers/getCategory';

    }

    echo json_encode($results);

    exit();

}

}

enter image description here

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

Make sure the domain name from which you're requesting data is present in network_security_config.xml file.

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda