girishg4t / bhavCopy-downloader

Get free NSE and BSE data(bhavcopy, derivatives), based on customizable index and date. Give it a star if you like it
https://www.freehtmlchecker.com/bhavcopy-downloader
48 stars 10 forks source link

Cross-Origin Request Blocked #31

Closed MrBrowner closed 11 months ago

MrBrowner commented 1 year ago

Cloned the project & ran successfully. but, when i tried to download a file.

i got this in console.

Cross-Origin Request Blocked: 
The Same Origin Policy disallows reading the remote resource 
at https://bhavcopy-backend.fly.dev/getbhavcopy. 
(Reason: CORS header ‘Access-Control-Allow-Origin’ missing).
Status code: 200.

why so ?

Thanks.

ps: it's my first time coding a web project

MrBrowner commented 1 year ago

okay. After some search, i got to know is:

we have to define "Access-Control-Allow-Origin", "*" in the header.

But, where is headers in the axios api call ?

girishg4t commented 1 year ago

In the backend we need to allow that header, but * is not recommended. you have to run the backend on your local as well for this

or you can call this api's directly from you local https://bhavcopy-backend.fly.dev/

MrBrowner commented 1 year ago

The URL is already defined in config.url.

how so ? where/what to make changes ?

can please help me to setup it.

Thanks & Regards.

girishg4t commented 1 year ago

@MrBrowner How to run the application on local 1) clone the repo 2) do npm install 3) npm start 4) when you click download you will get CORS error, for that install cors extension in your browser and enable it, in my case in Firefox i am using

CORS Everywhere
Bypass CORS restrictions by altering http responses.

similar kind of extensions will exists in Chrome

let me know if you want to contribute and want to get some idea on project, we can have a call as well

MrBrowner commented 1 year ago

@girishg4t Thank you very much.

as i was stuck on pt.4. Now it's able do api call successfully also, there is a warning in console Attempt to set a forbidden header was denied: Origin

& yes, I'm happy to make contribution to the project, we can have a scheduled call on gmeet?

girishg4t commented 1 year ago

Sure, schedule a call. i am mostly available as i am doing WFH

MrBrowner commented 1 year ago

hey. was setting-up multi ssh keys, totally confusing.. at last it accepted the commit.

we can have meet today ?

After committing a change, their is an issue.. the commit is made from my bitbucket ssh & not from my github ssh !

it's really confusing.

girishg4t commented 1 year ago

we can check today

MrBrowner commented 1 year ago

@girishg4t what time should we schedule a gmeet? I'm available, any time will do.

girishg4t commented 1 year ago

Before 4 pm today is fine, also please share your email id my is talekar.g@gmail.com

MrBrowner commented 1 year ago

Yes, shared the meet link on email.

girishg4t commented 1 year ago

@MrBrowner i have pinged you on gmail, let's connect when both are available

MrBrowner commented 1 year ago

we can connect now.

girishg4t commented 1 year ago

YES