Page redirect in custom WebformHandlerBase I have written a custom WebformHandlerBase and attached it to the Mulitpage webform. With this I'm able to get the values into the custom handler as soon as user clicks on Next Page> button

class MyFormHandler extends WebformHandlerBase {
     public function submitForm(array &amp;$form, FormStateInterface $form_state, WebformSubmissionInterface $webform_submission) {

         $form_id = 'webform_submission_' . $webform_submission-&gt;getWebform()-&gt;id() . '_form';

         if($form_id == 'webform_submission_registration_content_form') {
            $values = $webform_submission-&gt;getData();
            /* custom code to calculate the score based on the values */
             $eligible_to_participate = 1;
             if ($score &gt;= x &amp;&amp; $score &lt;= y) {
                  $eligible_to_participate = 1;
              }
             else
             {
                 $eligible_to_participate = 0;
             }
             if($eligible_to_participate == 0) {
                  // This user is not eligible so redirect to 'finish page'
                  /* The below code is not working 
                   * how-ever the same code is working in hook_form_FORM_ID_alter()
                   */
                  $url = Url::fromRoute('entity.node.canonical', ['node' =&gt; 78]); 
                  $response = new RedirectResponse($url-&gt;toString()); 
                  $response-&gt;send();
              }
          }
      }
 }


Based on the user selected values I need to redirect the user to a different page and the code for doing the same is as follows

 use Drupal\Core\Url;
 use Symfony\Component\HttpFoundation\RedirectResponse;

 $url = Url::fromRoute('entity.node.canonical', ['node' =&gt; 78]);
 $response = new RedirectResponse($url-&gt;toString());
 $response-&gt;send(); 


Now the problem is, this code is not working in custom handler function. If I write the same code in hook_form_FORM_ID_alter() it is working fine.

Any idea where am I doing wrong? Any help much appreciated.
&lt;?php
namespace Drupal\sa_webform\Plugin\WebformHandler;

use Drupal\Core\Session\AccountInterface;
use Drupal\Core\Serialization\Yaml;
use Drupal\Core\Form\FormStateInterface;
use Drupal\webform\Plugin\WebformHandlerBase;
use Drupal\webform\webformSubmissionInterface;

/**
 * Form submission handler.
 *
 * @WebformHandler(
 *   id = "my_webform_handler",
 *   label = @Translation("My webform handler"),
 *   category = @Translation("Webform Handler"),
 *   description = @Translation("Calculate the score with webform 
 *                                                     submissions"),
 *   cardinality = 
 *       \Drupal\webform\Plugin\WebformHandlerInterface::CARDINALITY_SINGLE,
 *   results = 
 *    \Drupal\webform\Plugin\WebformHandlerInterface::RESULTS_PROCESSED,
 * )
 */

 class MyWebformHandler extends WebformHandlerBase {
 /**
  * {@inheritdoc}
  */
    public function submitForm(array &amp;$form, FormStateInterface $form_state, 
                           WebformSubmissionInterface $webform_submission) {

       $form_id = 'webform_submission_' . $webform_submission-&gt;getWebform()-
               &gt;id() . '_form';
       if($form_id == 'webform_submission_xxx_form') {
         $values = $webform_submission-&gt;getData();  
         /* Take the action based on the Webform submission values */   
       }    
    }

    public function confirmForm(array &amp;$form, FormStateInterface 
          $form_state, WebformSubmissionInterface $webform_submission) {
       $form_id = 'webform_submission_' . $webform_submission-&gt;getWebform()-
                                                  &gt;id() . '_form';
       if($form_id == 'webform_submission_xxx_form')
       {
          if(based_on_some_condition) {
          /* Here 12 is the node id where i wanted to redirect to */
          $form_state-&gt;setRedirect('entity.node.canonical',['node' =&gt; 12]);
       }
    }
}   
?&gt;


For more examples refer webform modules src code located at webform\src\Plugin\WebformHandler

BrokenWebformHandler.php

DebugWebformHandler.php

EmailWebformHandler.php

RemotePostWebformHandler.php