2

I have a running nginx server with the following location config:

    location /test_args/ {
        return 200 $arg_z$arg_x$arg_y;
    }

So I'm trying to send z, x and y values in response.

When running http request

curl http://127.0.0.1:8090/test_args/?z=12&x=34&y=56

I get only 12 in response. This is a value of the first parameter z. Other parameters are omitted. I expect the response to be 123456

How do I make nginx read multiple URL parameters?

5
  • Works perfectly for me. Do you have any rewrites or something before which replaces the url? Try returning $request_uri to see the current url. Commented Nov 30, 2016 at 10:43
  • @nu11p01n73R $request_uri returns everything before first & sign. Here's the output: /test_args/?z=12 Commented Nov 30, 2016 at 11:52
  • I doubt it is because some other script is rewriting you request uri and striping off the params Commented Nov 30, 2016 at 12:30
  • Tried to quote url in CURL and it worked eventually. Strange Commented Nov 30, 2016 at 12:42
  • 4
    It is because the shell is interpreting the & differently. see this answer stackoverflow.com/a/10691154/3150943 Commented Nov 30, 2016 at 12:45

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.