public function postProcess(Request $request, Response $response)
    {
        if (empty($this->allowedOriginHosts) || !$request->hasHeader('HTTP_ORIGIN')) {
            return;
        }

        $originHost = $request->readHeader('HTTP_ORIGIN')->unsecure();
        foreach ($this->allowedOriginHosts as $allowedOriginHost) {
            if (preg_match('~' . $allowedOriginHost . '~', $originHost) === 1) {
                $response->addHeader('Access-Control-Allow-Origin', $originHost);
            }
        }
    }