title: How to send a response with HAProxy without passing the request to web servers
body: <p>The server is receiving thousands of <strong>OPTIONS</strong> requests due to <em>CORS</em> (Cross-Origin Resource Sharing). Right now, every options request is being sent to one of the servers, which is a bit wasteful, knowing that HAProxy can add the <em>CORS</em> headers itself without the help of a web server.</p>
  
  <pre><code>frontend https-in
      ...
      use_backend cors_headers if METH_OPTIONS
      ...
  
  backend cors_headers
      rspadd Access-Control-Allow-Origin:\ https://www.example.com
      rspadd Access-Control-Max-Age:\ 31536000
  </code></pre>
  
  <p>However for this to work I need to specify at least one live server in <strong>cors_headers</strong> backend and that server will still receive the requests.</p>
  
  <p>How can I handle the request in the backend without specifying any servers? How can I stop the propagation of the request to servers, while sending the response to the browser and keeping the connection alive?</p>