Thanks Francis, that is an interesting approach (with a map). Will give it a
try. And good point on only allowing pre-defined patterns to be passed from
arg to root.
Posted at Nginx Forum:
https://forum.nginx.org/read.php?2,270868,270882#msg-270882
___
On Fri, Nov 11, 2016 at 08:30:06AM +, Francis Daly wrote:
> On Thu, Nov 10, 2016 at 06:46:10PM -0500, ulik wrote:
Hi there,
> > # root when path query arg is present
> > if ($arg_path) {
> > root /var/www/example/$arg_path;
> > }
> You can use "map" to set a variable, and
On Thu, Nov 10, 2016 at 06:46:10PM -0500, ulik wrote:
Hi there,
> Here is what I want to do, in nginx conf language:
> # root when path query arg is present
> if ($arg_path) {
> root /var/www/example/$arg_path;
> }
>
> # root when path query arg is not present (defau
Here is what I want to do, in nginx conf language:
server {
listen 80;
server_name www.example.com;
# root when path query arg is present
if ($arg_path) {
root /var/www/example/$arg_path;
}
# root when path query arg is not present (default)
if (!$arg_pat
On Thu, Nov 10, 2016 at 03:04:43PM -0500, ulik wrote:
Hi there,
> Is it possible to set/modify location based on the query string arg from
> request?
The one-word answer is "no".
So the follow-up question is: what do you want to do?
> Here is the scenario:
>
> Request: www.example.com/demo?pa
Is it possible to set/modify location based on the query string arg from
request?
Here is the scenario:
Request: www.example.com/demo?path=abc
Docroot: /var/www/example/abc/
Request: www.example.com/demo?path=xyz
Docroot: /var/www/example/xyz/
Posted at Nginx Forum:
https://forum.nginx.org/rea