juju / juju-gui

Juju-GUI is a web-based GUI for Juju <https://jujucharms.com/>.
Other
182 stars 85 forks source link

CORS error when searching for charms #3910

Closed mdavis-xyz closed 5 years ago

mdavis-xyz commented 5 years ago

Whenever I try to search for a charm from the GUI it says:

Something went wrong

For some reason the search failed. You could try searching at http://jujucharms.com or go back

This happens every time I search for anything.

My Juju controller machine has internet access. I can wget http://jujucharms.com from the machine.

The issues are:

  1. The search fails
  2. The error message is not descriptive enough to be helpful
mdavis-xyz commented 5 years ago

I just openned the console. I can see a flood of error messages.

They are all about Cross-Origin warnings.

Search request failed. no entity data returned, can you access the charmstore? combo:1:445025

Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://api.jujucharms.com/charmstore/v5/search?text=haproxy&tags&limit=150&autocomplete=1&include=charm-metadata&include=supported-series&include=bundle-metadata&include=extra-info&include=owner. (Reason: CORS request did not succeed).

There are infinite retries with no wait in between, so while I am reading the error message, the page is maxing out a whole CPU trying the same thing again and again. There should be a delay between retries, ideally with exponential backoff.

But the core issue is CORS a error.

I am accessing the Juju GUI from another machine, so the URL in my browser is https://10.58.2.36:17070/gui/u/admin/contrail I am using Firefox 66.0.2.

hatched commented 5 years ago

I'm not able to reproduce this, are you still able to reproduce this issue?

mdavis-xyz commented 5 years ago

I found the cause.

It was a particular browser extension I use. (Privacy Badger)

The log messages in the console happen to look like CORS errors, so I thought it was a CORS issue.