I have three Spring boot applications running on embedded tomcat on ports 8080, 8081, 8082.
I am trying to configure reverse proxy for all of them, When hitting the url I am getting 401 error which is from Spring security.
I have configured the nginx as follows:
worker_processes 1;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
server {
listen 80;
server_name localhost;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; #also tried $remote_addr;
location /first {
proxy_pass http://localhost:8081;
}
location /second {
proxy_pass http://localhost:8080;
}
location = /third {
proxy_pass http://localhost:8082;
}
}
}
the url I am trying to access is http://localhost/second/ this gives me error saying There was an unexpected error (type=Unauthorized, status=401).
Full authentication is required to access this resource
when tried to access http://localhost:8080/swagger-ui.html gives me 404 error.
when tried to access http://localhost:8080/swagger-ui.html shows me expected page of Swagger.