Base solution for your next web application
Open Closed

Getting cors origin issue with external urls #10616


User avatar
0
shedspotter created

Hi, I am getting cors origin issue with following urls. https://api.giphy.com/v1/gifs https://g.tenor.com/v1 Thanks

Prerequisites
  • What is your product version? 10.3.0
  • What is your product type? Angular
  • What is product framework type? .net core

11 Answer(s)
  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @shedspotter

    Could you share how do you use these URLs in your app ?

    Thanks,

  • User Avatar
    0
    shedspotter created
    /* Tenor API */
    getTrending(page: number): Observable<HttpResponse<any>> {
        const limit = 100;
        const url = `${environment.tenorEndpoint}/trending?key=${environment.tenorApikey}&limit=${limit}&contentfilter=high`;
        return this.http.get<any>(url, { observe: 'response' });
    }
    
    /* Giphy API */
    getTrending(page: number): Observable<HttpResponse<any>> {
        const url = `${this.giphyUrl}/trending?api_key=${this.giphyApiKey}&limit=100;&offset=${page}&tag=&rating=g`;
        return this.http.get<any>(url, { observe: 'response' });
    }
    

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    Are you able to call those URLs using a tool like Postman ?

  • User Avatar
    0
    shedspotter created

    I have able to access same url in separator demo angular app.

  • User Avatar
    0
    shedspotter created

    I am also able to access using "https://www.thunderclient.io/"

  • User Avatar
    0
    shedspotter created

    Hi 👋 Any luck? 🤔

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @shedspotter

    Sorry for the delay on my reply. Since these tools are non-web apps, they will not be checked by CORS policy. Is the app you are getting CORS error hosted as HTTP or HTTPS ?

    It might be similar to this one

  • User Avatar
    0
    shedspotter created

    Hi @ismcagdas

    Sorry for the delay on my reply. I am still not able to access external url. I tried above stackoverflow trick but not working.

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi **@shedspotter **

    Is it possible to share your app (or a new AspNet Zero app with this problem) ? We can check the problem and find the problem faster in that way.

    Thanks,

  • User Avatar
    0
    shedspotter created

    Hi, Can we resolve this issue without share app ?

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    If this problem happens in your local development environment, yes, we can solve it. We can also take a look at your high CPU usage problem.

    Thanks,