0

I'm running the latest version of the Drupal docker container.
I'm trying to make a GET API call via Javascript and I'm receiving back CORB (cross-origin-read-blocking) errors in the Console when trying to make a get request and displaying the output in console.log.
I'm using JSON API module to query the API.

Everything is being done on localhost.
I have Drupal running on port 4700 and just testing with a local HTML file and JS file.

In Firefox, I can see an actual response in the Network tab, but under Console I'm receiving a similar message about CORS/CORB.

How do I modify the Access-Control-Origin-Allow in Drupal to *

Here is the JS I'm using for my call:

  // Create a request variable and assign a new XMLHttpRequest object to it.
  var request = new XMLHttpRequest()

  // Open a new connection, using the GET request on the URL endpoint
  request.open('GET', 'http://localhost:4700/jsonapi/node/espot_html/fbaab7dd-09c2-4aa0-852d-4b9462074a45 ', true)

  request.onload = function() {
    // Begin accessing JSON data here
    <!-- var data = JSON.parse(this.response) -->

<!-- data.forEach(processed { -->
  <!-- // Log the repsonses -->
  <!-- console.log(processed.block) -->
  }

  // Send request
  request.send()
3

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.