Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CORS error when using extension outside of the official hopscotch instance #184

Open
mklilley opened this issue Dec 15, 2022 · 1 comment

Comments

@mklilley
Copy link

mklilley commented Dec 15, 2022

Hi there.

I'm a bit confused about how the browser extension is supposed to work.

I installed the extension in brave and was then able to send requests to previously CORS blocked sites from https://hoppscotch.io/. I was able to do this by switching on the interceptor in the settings - everything was super clear and easy.

I wasn't however sure what the Add new origin thing in the extension was supposed to do. In the README of this repo is says:

If you want to use the extension anywhere outside the official Hoppscotch instance you may want to add the domain to the extension's origin list. You can access the origin list by clicking on the extension icon on your browser toolbar.

I took this to mean that if I add e.g. http://localhost:3000 then if I'm on http://localhost:3000 and I make a request to e.g. https://www.fruityvice.com/ then I won't have any CORS issues because hopscotch extension will make the request to https://www.fruityvice.com/ for me and add all the necessary CORS stuff. I was not able to make it work though. I still got CORS issues doing this. I also wondered whether instead I should add https://www.fruityvice.com/ as a new origin. I tried it and this also didn't work - I still got CORS errors when requesting https://www.fruityvice.com/ from http://localhost:3000

Perhaps I'm misunderstanding how to use the extension anywhere outside the official Hoppscotch instance.

Could someone offer some guidance please.

Thanks

@kwmiebach
Copy link

kwmiebach commented Feb 19, 2023

Adding the url of the hoppscotch instance from the browser worked for me. Just copy paste it from the address bar from the hoppscotch instance where you are doing the requests. Remeber to include the correct protocol (http or https) and also the port.

After adding the url in the browser extension I hard reloaded the hoppscotch page with ctrl-klick on the reload button of the browser. This worked for me in firefox and google chrome on linux but not in edge (also linux).

I did not try this with IPs in the url, only with domain names like http://localhost:3000 or http://myserver.localdomain:3000

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants