0

I have an nginx server with configuration;

 server {
  listen 9090;
  server_name localhost;
  root /Users/anonuser/Desktop/workspace/ttttt/portal/design;

which has a set of rewrite and proxy_pass commands;

rewrite ^.*(/account/.*)$ $1 last;
 location /account {
      proxy_pass         https://www.example.com;
 }

 rewrite ^.*(/iap-dataapi/.*)$ $1 last;   
 location /iap-dataapi {
      proxy_pass         https://www.example.com;
 }

 rewrite ^.*(/era/.*)$ $1 last;
 location /era/ {
      proxy_pass         https://www.example.com;
 }

 rewrite ^.*(/imageScaler/.*)$ $1 last;
 location /imageScaler/ {
      proxy_pass         https://www.example.com;
 }

I am calling the application located in;

http://localhost:9090/oba-client/com/tttt/portal/cust/

There is the index.html file located in and it has a line to make a ajax request to a host something like;

http://localhost:9090/com/ericsson/iptv/portal/tttt/account/login

somehow this call from the application repeated 7 times ( I can see from the access logs) and fails with no response.

If I make the same request from POSTMAN request succeed.

I got really stucked at this point and can not find a way out to make this work;

so my aim is actually; forward requests to remote server (to be able to bypass cors) based on some keywords.

mohan08p
  • 105
  • 5
Olgun Kaya
  • 137
  • 2
  • 10
  • The rewrite statements look dangerous, I would use `^.+(/account/.*)$` to prevent any hint of a redirection loop. Having said that, the `rewrite...last` in the `server` context should be reasonably safe, and I have not been able to make it fail. – Richard Smith Sep 12 '17 at 14:05
  • Based on current API URL structure that I am calling I need to go with this. As of now. Still trying more to see what's going on. – Olgun Kaya Sep 12 '17 at 15:13
  • The problem was with the lua directives to capture response body from upstream. Removed them and now the config working as expected. @mods please close this as inappropriate context. – Olgun Kaya Sep 12 '17 at 20:43

0 Answers0