I opened up JSON:API Explorer to anonymous users and got this error:

LogicException: The content cannot be set on a StreamedResponse instance. in Symfony\Component\HttpFoundation\StreamedResponse->setContent() (line 129 of /var/www/html/vendor/symfony/http-foundation/StreamedResponse.php).
    public function setContent($content)
    {
        if (null !== $content) {
            throw new \LogicException('The content cannot be set on a StreamedResponse instance.');
        }

The link is available at: https://d2.api.demo.centarro.io/jsonapi/explorer/app?location=http%3A%2F...

It works fine when logged in.

Comments

mglaman created an issue. See original summary.

mglaman’s picture

Issue summary: View changes
mglaman’s picture

Issue summary: View changes
mglaman’s picture

Status: Active » Closed (cannot reproduce)

Whoops. It's due to the nginx-proxy and https/http confusion.

mglaman’s picture

Title: The content cannot be set on a StreamedResponse instance » ActiveLinkResponseFilter breaks explorer for anonymous users
Status: Closed (cannot reproduce) » Active

ActiveLinkResponseFilter breaks streamed responses for anonymous users.

    // For authenticated users, the 'is-active' class is set in JavaScript.
    // @see system_page_attachments()
    if ($this->currentUser->isAuthenticated()) {
      return;
    }

    $response = $event->getResponse();
    $response->setContent(static::setLinkActiveClass(
      $response->getContent(),
      ltrim($this->currentPath->getPath(), '/'),
      $this->pathMatcher->isFrontPage(),
      $this->languageManager->getCurrentLanguage(LanguageInterface::TYPE_URL)->getId(),
      $event->getRequest()->query->all()
    ));

😱

So Drupal core needs to check the response type.