# Conditional return of proxied responses

**URL:** <https://www.ruby-forum.com/t/conditional-return-of-proxied-responses/194289>\
**Category:** NGINX\
**Created:** [September 2, 2010, 1:38am UTC](https://www.ruby-forum.com/t/conditional-return-of-proxied-responses/194289 "2010-09-02T01:38:43Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Neal\_Richter](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/dc4da7/32.png) [@Neal\_Richter](https://www.ruby-forum.com/u/Neal_Richter)\
**Post date:** [September 2, 2010, 1:38am UTC](https://www.ruby-forum.com/t/conditional-return-of-proxied-responses/194289/1 "2010-09-02T01:38:43Z")

</div>

Hi Nginx!

I’m using nginx-0.8.49 as a caching proxy and would like to  
configure or implement the following:

Proxy incoming request to back-end servers  
Check HTTP response headers for a unique string in either “Server” or  
some “X-foo” lines.  
IF check passes then return the response to the client  
Else pass back an error message or HTTP 204.

Why?  
Sometimes in systems like EC2 the backend at a given IP that used to  
be yours may not be your box anymore (the IP might be reused).  
Simple token-based security/sanity check that the response is coming  
from your backend server.

If this can’t be configured out-of-the-box… the most logical way to  
implement this is with a response filter and a nginx plug-in correct?

Thanks - Neal Richter
