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

Error: Network Error. Check console for details #704

Closed
HappinerWinnie opened this issue Mar 24, 2020 · 18 comments
Closed

Error: Network Error. Check console for details #704

HappinerWinnie opened this issue Mar 24, 2020 · 18 comments

Comments

@HappinerWinnie
Copy link

Describe the bug

To Reproduce
Steps to reproduce the behavior:

  1. Open Postwoman
  2. Click on Send
  3. Scroll down to console
  4. See error

Expected behavior
response OK

Screenshots
image

Desktop (please complete the following information):

  • OS: Win10
  • Browser chrome, safari
  • Version 79.0.3945.117
@liyasthomas
Copy link
Member

liyasthomas commented Mar 24, 2020

If your endpoint is in localhost, please install official browser extensions to support localhost endpoints and fix CORS errors.

Official extensions

@HappinerWinnie
Copy link
Author

It's the same effect if I use ip
image

@liyasthomas
Copy link
Member

Are you sure the requested endpoint have CROS disabled?

@Slaviusz
Copy link

Can we reopen this? I have the same issue, with/without the extension. I cannot open any connection to localhost.

@liyasthomas
Copy link
Member

@AndrewBastin

@liyasthomas liyasthomas reopened this Mar 27, 2020
@Slaviusz
Copy link

Thanks.
Basically, my symptoms are exactly the same. Trying to call rest API endpoint on localhost results in :

Access to XMLHttpRequest at 'http://127.0.0.1:9000/api/auth/login' from origin 'http://localhost:3000' 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.

I tried installing the extension and also including the URL into unsafely-treat-insecure-origin-as-secure origins to no avail.

Thanks for help.

@liyasthomas
Copy link
Member

liyasthomas commented Mar 27, 2020

Please check these hotfixes:

  1. Check you've installed the latest version of browser extension. Kindly go through the extension's link (in readme) and verify the installed version number.
  2. Check Postwoman is allowed to use extensions. Navigate to Settings > Extensions section on web app. Make sure "Use extension" toggle switch is turned on.
  3. Check endpoints don't have CROS restrictions.

@Slaviusz
Copy link

Slaviusz commented Mar 27, 2020

  1. compiled Postwoman 30 minutes ago from latest git commit. Installed the extension 15 minutes ago from official link provided within Postwoman. The version reported is 0.5. I also tried manual update in browser's extensions config page.
  2. Extension is allowed, active and configured with access to URLs and in Incognito.
  3. CORS is NOT enabled on this app (I'm the developer)

However when I explicitly enabled CORS with Access-Control-Allow-Origin: * everything works now. Is it now enforced that the host MUST enable CORS otherwise the behavior is equal to invalid origin?
Honestly I don't remember such behavior and it is enforced at the application level. When I do plain cURL request everything works just fine. Is maybe one of your dependency packages enforcing this?

@liyasthomas
Copy link
Member

liyasthomas commented Mar 27, 2020

If that's the case, we'll have to look further into it. Huge thanks for debugging and reporting the issue.

@Slaviusz
Copy link

You're welcome. Thanks for having a look.

@AndrewBastin
Copy link
Member

AndrewBastin commented Mar 27, 2020

Hi there,

Sorry for the late response, I am really swamped with personal stuff and end of the semester university work.

Due to security concerns of allowing open access to the extension hooks, the Postwoman Extension only hooks into the following domains

http(s)://postwoman.io/
http(s)://postwoman.netlify.com/

What that implies is that, you aren't allowed to access the extension if you are not in the above domains, so your locally hosted Postwoman builds can't access the official browser extension.

If you are using localhost, you will need to make your own build of the extension (more info on that here) with the permissions activated for your localhost page in the manifest.

I would love to make the extension an open system but this is implemented to prevent unauthorized bypassing of CORS by malicious sites that are not Postwoman.

Feel free to ask questions regarding this though, but I am closing this issue as this is an intended safeguard.

Thanks for using Postwoman ❤️

@liuxueyiTest
Copy link

3. Check endpoints don't have CROS restrictions

how to do ?

@liyasthomas
Copy link
Member

liyasthomas commented Dec 4, 2020

  1. Check endpoints don't have CROS restrictions

how to do ?

CORS is a security mechanism imposed on API endpoints. Its easily discoverable from the developers side. You can simply try hitting the endpoint from Hoppscotch.io and if there's no issue, and you got Okay 200 response, then it doesn't have CORS. If API response got any error, check console logs to know whether it's due to CORS restrictions. You can fix CORS issues with Hoppscotch Extension.

@liuxueyiTest
Copy link

liuxueyiTest commented Dec 4, 2020 via email

@liyasthomas
Copy link
Member

@liuxueyiTest
Copy link

liuxueyiTest commented Dec 4, 2020 via email

@liuxueyiTest
Copy link

liuxueyiTest commented Dec 4, 2020 via email

@liuxueyiTest
Copy link

如果我访问我本地的自己部署的 hoppscotch 意思我要自己弄个浏览器扩展。

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

5 participants