title: Magento Redirect from Observer that always works
body: <p>I am having trouble to create a working redirect in Magento from an observer.</p>
  
  <p>As far as I know there are many events that got the response object with them (in the <code>$observer</code> object).
  Another way would be to use something like</p>
  
  <pre><code>Mage::app()-&gt;getResponse()-&gt;setRedirect(Mage::getUrl('checkout/cart'));
  </code></pre>
  
  <p>as mentioned here <a href="https://stackoverflow.com/a/4730200/1700048">https://stackoverflow.com/a/4730200/1700048</a> by the great Alan Storm.</p>
  
  <p>Unfortunately this does not work for me, even when I add <code>sendResponse()</code> like this:</p>
  
  <pre><code>Mage::app()-&gt;getResponse()-&gt;setRedirect(Mage::getUrl('checkout/cart'))-&gt;sendResponse();
  </code></pre>
  
  <p>For example:</p>
  
  <p>I want to prevent some email addresses to newsletter subscription. 
  Therefore I created an observer for the <code>newsletter_subscriber_save_before</code> Event.</p>
  
  <p>In my observer method I check some cases and if they trigger I want to prevent the saving of the newsletter subscribtion.
  My plan was to add an error like this: </p>
  
  <pre><code>Mage::getSingleton('checkout/session')-&gt;addError('Email is spam!');
  </code></pre>
  
  <p>and just let the current page reload (showing the error message) with a redirect as seen above (<code>checkout/cart</code> in the example is just to see it really works).</p>
  
  <p>Unfortunately the redirect does not work. 
  Why does <code>sendResponse</code> not send the response in this case? </p>
  
  <p>Thanks for help :)</p>