Welcome! Log In Create A New Profile


rewrite rule for subrequest

May 11, 2010 06:04PM
when implementing a rewrite rule for a subrequest which is the proper way to tackle the issue

1. write the rewrite rule in the main location (location /), the location where the subrequests are generated
2. write the rewrite rule in the subrequest location

i am using two subrequests to concatenate the document's contents residing at the requested URL


main request

GET /path/to/files/document_1.html

i generate two subrequests allowing me to chunk the response to the client as the document's contents are large


echo_subrequest_async GET /sub1 -q $request_filename;
- where request_filename = /path/to/files/document_1.html


echo_subrequest_async GET /sub2 -q $request_filename;
- where
request_filename = /path/to/files/document_1.html before rewrite rule
request_filename = /path/to/files/document_2.html after rewrite rule

here is the rewrite rule i'm using

rewrite ^(_.*)$ $1_2.html break;
- so subrequest1 would go to /path/to/files/document_1/html and subrequest2 would go to /path/to/files/document_2.html

i've attempted putting the rewrite rule in the default location and also the subrequest2 location. on my backend i am able to trace the request is coming from the subrequest2 location but the URL passed through is the original URL and not my modified URL.

i know i must be missing something in the documentation, but i'm not sure what it may be. how do you use a modified version of the URL from subrequest1?

Subject Author Posted

rewrite rule for subrequest

peterjanovsky May 11, 2010 06:04PM

Re: rewrite rule for subrequest

peterjanovsky May 11, 2010 06:11PM

Re: rewrite rule for subrequest

agentzh May 11, 2010 09:44PM

Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 81
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready