CORS issues on Azure Search Service

Ana Belen Rincon Saenz 5 Puntos de reputación
2024-05-08T15:45:09.5366667+00:00

How can I allow my domain to make a successful GET request without being blocked by CORS policy.
I am already configurate the custom cors option in the indexer.
Error:
Access to XMLHttpRequest at 'https://urlsearch/indexers/indexer/run?api-version=2023-11-01' from origin 'https://appservicesopenai.azurewebsites.net' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.

Thanks in advance.

Azure
Azure
Plataforma e infraestructura de informática en la nube para crear, implementar y administrar aplicaciones y servicios a través de una red mundial de centros de datos administrados por Microsoft.
479 preguntas
0 comentarios No hay comentarios
{count} votos

1 respuesta

Ordenar por: Muy útil
  1. Gao Chen 4,385 Puntos de reputación Proveedor de Microsoft
    2024-12-21T00:28:43.65+00:00

    Hello Ana Belen Rincon Saenz,

    Welcome to Microsoft Q&A!

    We are very sorry for the delay in giving you a response to your topic in this forum. If you still have the same problem, it sounds like you're encountering a common Cross-Origin Resource Sharing (CORS) issue. Here are a few steps you can take to resolve this:

    Check Server-Side CORS Configuration: Ensure that your server is configured to include the Access-Control-Allow-Origin header in its responses. This header should specify the origin that is allowed to access the resource. For example:

       Access-Control-Allow-Origin: https://appservicesopenai.azurewebsites.net
    

    Handle Preflight Requests: CORS preflight requests are sent by the browser to check if the actual request is safe to send. Make sure your server responds to these preflight requests with the appropriate headers:

       Access-Control-Allow-Methods: GET, POST, OPTIONS
       Access-Control-Allow-Headers: Content-Type, Authorization
    

    Use a Proxy Server: If you can't modify the server's CORS settings, you can use a proxy server to make the request on behalf of your client. This way, the request appears to come from the same origin.

    Browser Extensions: For development purposes, you can use browser extensions that disable CORS restrictions. However, this is not recommended for production environments due to security risks.

    Verify Configuration: Double-check your CORS configuration in the indexer to ensure it's correctly set up. Sometimes, small typos or misconfigurations can cause issues.

    In case you need the source documentation: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS/Errors.

    Additionally, please kindly note that if we do not receive a response to this thread within 4 business days, we will consider it closed. In case you have the same question, and the information provided was not useful, feel free to create another thread and we will be more than happy to help you.

    Regards,

    Gao


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    0 comentarios No hay comentarios

Su respuesta

Las respuestas se pueden marcar como respuestas aceptadas por el autor de la pregunta, lo que ayuda a los usuarios a conocer la respuesta que resolvió el problema del autor.