NGINX - Not Calling Java Based Auth Applicaiton running in Spring Boot

zaidahmd nginx-forum at forum.nginx.org
Thu Mar 30 05:06:43 UTC 2017


Hi,

I am implementing nginx as API gateway. I have two applications written in
spring-boot-web with angularjs. One application is which is auth application
and has login.html page inside it. The othe is my upstream applicaiton.

My issue is when I comment/disable the /auth part of the below config, my
applicaiton becomes accessible via nginx. But, when I enable the auth config
in nginx, i start getting http 500 error. I am not getting detailed logs in
NGINX so don't know how to send more details in the forum.


Following is my nginx.conf.

           http {
               include       mime.types;
               default_type  application/octet-stream;
               sendfile        on;
               keepalive_timeout  65;

               server {
                   listen       8180;
           
           		# web user traffic service
           		location /adi{
           			auth_request /auth;
           			proxy_set_header  X-Real-IP $remote_addr;
           			proxy_set_header  X-Forwarded-For $proxy_add_x_forwarded_for;
           			proxy_set_header  X-Forwarded-Host $host;
           			proxy_set_header  X-Forwarded-Server $host;		
           			proxy_set_header  Host $http_host;
           			
           			proxy_pass http://adi-backend;
           		}
           
           		location =/auth{
           			internal;
           			proxy_set_header  X-Real-IP $remote_addr;
           			proxy_set_header  X-Forwarded-For $proxy_add_x_forwarded_for;
           			proxy_set_header  X-Forwarded-Host $host;
           			proxy_set_header  X-Forwarded-Server $host;
           			proxy_set_header  Host $http_host;
           			
           			proxy_pass http://127.0.0.1:8080/;
           		}
                   error_page   500 502 503 504  /50x.html;
                   location = /50x.html {
                       root   html;
                   }
           		
                   error_page 401 = @error401;
	           error_page 404 = @error401;
           		location @error401 {
		           	return 302 http://adi-backend;
	           	}
		
               }
           	upstream adi-backend {
           		server localhost:8080;
   	           }
           }

Posted at Nginx Forum: https://forum.nginx.org/read.php?2,273294,273294#msg-273294



More information about the nginx mailing list