Question

how to config rest service with parameter in nginx

Posted October 11, 2021 83 views
NginxLogging

I am configuring rest and soap services in nginx. Soap service is working fine but for rest srvices its giving error 404 not found.In rest service I have parameter which is the problem.here is the config file for REST

events {}
http {
   default_type application/octet-stream;
    sendfile on;
    keepalive_timeout 65;
      charset utf-8;
    upstream backendserver {


        server 112.000.0.111:8000  backup;
        server 11.000.3.112:8000 max_fails=3 fail_timeout=180s ;

        keepalive 64;
    }
    server {
    listen 8000;
    include api_conf.d/*.conf;

        }
  location/services/ert/api/potentialvalue(.*)$ {
  limit_except GET {
                 deny all;
             }
       proxy_pass http://backendserver/ 
edited by KFSys

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

×
Submit an Answer
1 answer

Hi @alyamobeen,

First I see there are two servers added in the backend upstream :

        server 112.000.0.111:8000  backup;
        server 11.000.3.112:8000 max_fails=3 fail_timeout=180s ;

Are you sure these IPs are correct and you have access to them?

As for the parameter you’ve mentioned are you by any chances talking about : location/services/ert/api/potentialvalue(.*)? I think using it like that location/services/ert/api/potentialvalue$ should be enough.

  • yes APIs are correct and I do have access. but I can’t access the service. the url is /services/ert/api/parameter?arg=value
    any guess how it can work