code: public function overrideDefaultSettings($action)
      {
          if (isset($this->actions[$action->id])) {
              $actionParams = $this->actions[$action->id];
              $actionParamsKeys = array_keys($actionParams);
              foreach ($this->cors as $headerField => $headerValue) {
                  if (in_array($headerField, $actionParamsKeys)) {
                      $this->cors[$headerField] = $actionParams[$headerField];
                  }
              }
          }
      }
docs: Override settings for specific action.
  @param \yii\base\Action $action the action settings to override