CSC510-Group-5 / URL-Shortner

URL Shortner is a simple yet powerful tool to generate short versions of urls to share them conveniently with others. It allows users to update the existing long urls without having to reshare a new short version of url with others. The application has been developed in Python & Angular.
https://yoururl.tech/url-shortner
MIT License
3 stars 7 forks source link

CORS enable at API #54

Closed deep-mm closed 2 years ago

deep-mm commented 2 years ago

Currently when calling the API from Angular App, the following error is witnessed:

Access to XMLHttpRequest at 'https://sef22group5.pythonanywhere.com/new/' from origin 'https://deep-mm-csc510-group-5-url-shortner-96rxgpqgprqc7p4g-4200.githubpreview.dev' 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. input-long-url.component.ts:60

My initial understanding is CORS needs to be enabled at API end

alunavat commented 2 years ago

They are deployed on different servers right? I think the backend would have to allow our front-end server to connect

alunavat commented 2 years ago

There are two options, allow all or allow specific? @akk5597 @rohit97n @psurana-ncsu how do you guys wanna proceed?

deep-mm commented 2 years ago

@rohit97n has added CORS at API side to allow front end app to access it. I have verified it at angular app and it seems to be working

This closing this issue