add header after fcgi handling

Aleksandar Lazic al-nginx at none.at
Wed Aug 8 09:05:46 UTC 2012


Hi,

please can anybody help me, I'm stucked and sure that I think in wrong 
way.

the .htaccess

/web/root/interfaces/.htaccess

RewriteEngine on
RewriteBase /interfaces
RewriteRule ^json/(.*) index.php?x=$1&%{QUERY_STRING} [NC]

Translated to (the easy part I think)

         location ~ /interfaces/json/(\S+) {
           try_files /$uri /interfaces/index.php?x=$1&$args;
         }

now

Header set Access-Control-Allow-Origin *
Header set Access-Control-Allow-Headers "X-Requested-With, *"

to
         location /interfaces {
           include 
/home/nginx/server/conf/add_header-Access-Control-Allow-Origin.conf;
           add_header Access-Control-Allow-Headers "X-Requested-With, 
*";
         }

but when the php request is handled the 'location /interfaces {..}' 
does not match any more,
of course.

How can I add the header to the reply after the php is executed?!

Many thanks for help.
Best regards
Aleks



More information about the nginx mailing list