I am kidding around with CodeIgniter. I authored simple image proxy. When you attend address like:


it reads proper image, and returns it to browser. Everything works OK.

However I began to question, whether it's possible, to transmit image only if specific header exists. To tests I am using X-Asked for-With header. I have put my proxy script into

if($this->input->is_ajax_request()){ //proxy code...}

is_ajax_request it's standard CI function. Code below:

public function is_ajax_request()
    return ($this->server('HTTP_X_REQUESTED_WITH') === 'XMLHttpRequest');

Now, during my .htaccess file i added

<FilesMatch "\.tjpg$">
RequestHeader append X-Requested-With "XMLHttpRequest"

and today it appears such as this:

<FilesMatch "\.tjpg$">
RequestHeader append X-Requested-With "XMLHttpRequest"

DirectoryIndex index.php
RewriteEngine on
RewriteCond $1 !^(index\.php|images|css|js|robots\.txt|favicon\.ico)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ ./index.php/$1 [L,QSA]

Not to mention it's not working ) What I am doing wrong? Is it feasible whatsoever? My Apache server is running on Home windows whether it's relevant. mod_rewrite and mod_headers are installed.