nginx: rewrite URL but have original URL stored in access.log as 200
Posted
by
mhambra
on Server Fault
See other posts from Server Fault
or by mhambra
Published on 2011-11-17T09:23:56Z
Indexed on
2011/11/17
9:56 UTC
Read the original article
Hit count: 251
I'm setting up a link tracking system, which (temporarily) involves adding /link/id/ in front of URL (like http://server/data/id/publication/id/).
rewrite data/id/(.*) http://server/$1;
The request is logged as:
ip - - [17/Nov/2011:10:07:19 +0300] "GET /data/id/publication/id.html HTTP/1.1" 302 154 "-" "UA"`
For some reason (keeping the compatibility with AWStats) it is wanted to have 200 logged instead of 302. (nginx allows to get 301 code out of box with permanent option, but thats inappropriate too)
What are my options here?
Will the combination of location { }
and rewrite
do the job?
© Server Fault or respective owner