Answer the question
In order to leave comments, you need to log in
Authenticate in app from another app via nginx?
Good afternoon,
There are 2 Spring applications running on different ports, which are separated by 2 locations in nginx
. The first application has authentication through Spring Security and a local database of logins / passwords.
How to set up a bunch of all this so that access to the second application is possible only from the authentications of the first?
The applications themselves are on the same domain.
nginx configuration (redundant, like proxy_set_header for proxy_pass, removed)
server {
listen 80;
server_name domenname;
#Приложение 2
location /media/ {
proxy_pass http://127.0.0.1:8080/;
}
#Приложение 1
location /{
proxy_pass http://127.0.0.1:8000/;
}
}
Answer the question
In order to leave comments, you need to log in
You can transfer the authentication logic to nginx + lua, check for the presence of a header or token with a request to the local database of the first application.
Well, or such options as adding logic to the second application, making requests from the second application to the first, or merging projects, if possible.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question