I'm trying to set a 404 HTTP status response code for an ajax controller action in a plugin.
Yii has a response object where the code can be set, but I can't find a way to access it from craft.
I believe HeaderHelper::setHeader() is what you're looking for in the context of a plugin.
HeaderHelper::setHeader(array('status' => 404));
In Craft3, the correct way of setting HTTP status codes is