title: nginx proxy_pass for get request api call with parameters
body: <p>I have simple flask rest api that fetches data from database and gives result to user in json file. flask server gets parameters from html input fileds upon submit and these parameters are used to fetch data from database. It is working fine with flask inbuilt WSGI server. I wanted to deploy in production with nginx as my web server and gunicorn as application server. When I run docker container and access the root url, i can get html form for the user to input parameters. When I click on submit, another api resource call gets invoked, but I get either 'URL not found' or 'internal server error'. This surely problem with nginx location configuration for my get request api call with parameters in URL. Please help me how to configure nginx proxy_pass URL for this kind of request. </p>
  
  <p>My browser request URL look something like this when I submit form.
  <a href="http://IP" rel="nofollow noreferrer">http://IP</a> address/api/v1/service?key=12345&amp;name=abc&amp;id=1234</p>
  
  <p><strong>HTML (form.html)</strong></p>
  
  <pre><code>&lt;form  name="device" action="/api/v1/service"&gt;
  </code></pre>
  
  <p><strong>Python view functions</strong></p>
  
  <pre><code>@app.route('/')
  def my_form():
      return render_template('form.html')
  @app.route('/api/v1/service', methods=['GET'])
  def my_form_get():
      ..............
      .............
  </code></pre>
  
  <p><strong>nginx server</strong></p>
  
  <pre><code>server {
      listen      80;
  
      location / {
          proxy_pass http://localhost:5000/;
          proxy_set_header Host $host;
          proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
      }
     location  /api/v1/service {
          proxy_pass http://localhost:5000/api/v1/service;
          proxy_set_header Host $host;
          proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
      }
  }
  </code></pre>
  
  <p><strong>Gunicorn configuration</strong></p>
  
  <pre><code>[program:gunicorn]
  command=/usr/bin/gunicorn run:app -b localhost:5000
  directory=/deploy/app
  </code></pre>