Welcome! Log In Create A New Profile

Advanced

API Proxy is not working

Posted by Tharivol 
API Proxy is not working
June 17, 2019 03:58PM
Hi to everyone...

I'm having a problem with a reverse proxy at nginx...

Problem ->

I have the server A with nginx that receive many connections by port 80 and 443...
some connection come from api/rest and api/v2_soap...
for these connections i made a proxy rule to redirect to connection to server B, that will process the api request

The Rule at server A:

location /api/rest {
rewrite ^/api/rest(/.*)$ $1 break;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host:$server_port;
proxy_set_header X-NginX-Proxy true;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_cache_bypass $http_upgrade;
proxy_pass http://10.0.0.2;
proxy_redirect off;
}


location /api/v2_soap {
rewrite ^/api/v2_soap(/.*)$ $1 break;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host:$server_port;
proxy_set_header X-NginX-Proxy true;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_cache_bypass $http_upgrade;
proxy_pass http://10.0.0.2;
proxy_redirect off;
}

Fine... When i look inside server B nginx acess.log all connections are being redirect to server B.. Great...


But when the connection is being process , the server B access log show some GET request as status 200 and some POST requests as status 500

mydomain.com.br 10.0.0.2 - - [17/Jun/2019:15:35:21 -0300] "GET /api/v2_soap?wsdl=1 HTTP/1.0" 200 244478 "-" "-" "xxxx.xxxx.xxxx.xxxx"
mydomain.com.br 10.0.0.2 - - [17/Jun/2019:15:35:25 -0300] "GET /api/v2_soap?wsdl=1 HTTP/1.0" 200 244478 "-" "-" "xxxx.xxxx.xxxx.xxxx"
mydomain.com.br 10.0.0.2 - - [17/Jun/2019:15:35:26 -0300] "POST /api/v2_soap HTTP/1.0" 500 423 "-" "Axis/1.4" "xxxx.xxxx.xxxx.xxxx"
mydomain.com.br 10.0.0.2 - - [17/Jun/2019:15:35:28 -0300] "POST /api/v2_soap HTTP/1.0" 500 423 "-" "Axis/1.4" "xxxx.xxxx.xxxx.xxxx"


The configuration at nginx server B for api are:

# API config
location /api/rest {
rewrite ^/api/rest /api.php?type=rest last;
}

# API config
location /api/v2_soap {
rewrite ^/api/v2_soap /api.php?type=v2_soap last;



Now the question... what is wrong, what i must add, what i must do to apis rest and soap work fine at my server...

the central problem i think is soap connections... because i found some rest status POST and GET with status 200
Re: API Proxy is not working
July 01, 2019 01:59PM
nice
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 71
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