# 404 redirect or disconnect

**URL:** <https://www.ruby-forum.com/t/404-redirect-or-disconnect/223990>\
**Category:** NGINX\
**Created:** [October 25, 2012, 6:18pm UTC](https://www.ruby-forum.com/t/404-redirect-or-disconnect/223990 "2012-10-25T18:18:27Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![aris](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/258eb7/32.png) [@aris](https://www.ruby-forum.com/u/aris)\
**Post date:** [October 25, 2012, 6:18pm UTC](https://www.ruby-forum.com/t/404-redirect-or-disconnect/223990/1 "2012-10-25T18:18:27Z")

</div>

I have a custom site where valid users will always login and have a  
valid session (and a cookie or headers to represent it).

I would like to do the following, but not sure how to start…can  
someone just point me in the right direction?

IF user has a valid session (I need to check if the header/cookie is in  
the http request), and a 404 is appropriate, re-direct to a specific  
location (or a “real” 404 page).

ELSE (the user does not have a valid session for my  
website/application), return 444.

Really, I need to understand how to do the if/then and detect the cookie  
or header to indicate that the user is “valid”.

Thanks in advance,  
AJ
