why do i get redirected to /login?

hey guys. i have java spring app. it has this websecurity config chain:
@Override
protected void configure(HttpSecurity http) throws Exception {
http
.authorizeRequests()
.antMatchers("/sol/createPaymentInformation").permitAll()
.antMatchers("/sol/createPaymentConfirmation").permitAll()
.antMatchers("/sol/createPaymentReversal").permitAll()
.anyRequest().authenticated()
.and().formLogin().loginPage("/login").permitAll()
.and().logout().permitAll()
.and().csrf().disable();
}
@Override
protected void configure(HttpSecurity http) throws Exception {
http
.authorizeRequests()
.antMatchers("/sol/createPaymentInformation").permitAll()
.antMatchers("/sol/createPaymentConfirmation").permitAll()
.antMatchers("/sol/createPaymentReversal").permitAll()
.anyRequest().authenticated()
.and().formLogin().loginPage("/login").permitAll()
.and().logout().permitAll()
.and().csrf().disable();
}
1. when i launch my app on computer, my endpoints are called fine. 2. when i deploy my app to the server, the endpoints arent being called - i get 404 i have nginx on the server. i opened nginx access log:
"POST /bgw/sol/createPaymentInformation HTTP/1.1" 302 0 "-" "PostmanRuntime/7.43.0"
"GET /login HTTP/1.1" 404 146 "http://myserver.lv/bgw/sol/createPaymentInformation" "PostmanRuntime/7.43.0"
"POST /bgw/sol/createPaymentInformation HTTP/1.1" 302 0 "-" "PostmanRuntime/7.43.0"
"GET /login HTTP/1.1" 404 146 "http://myserver.lv/bgw/sol/createPaymentInformation" "PostmanRuntime/7.43.0"
i dont understand why its being redirected to /login. can smb help me out? as i understand its smth with nginx, not the java app itself.
14 Replies
JavaBot
JavaBot2mo ago
This post has been reserved for your question.
Hey @Fragmented friends! Please use /close or the Close Post button above when your problem is solved. Please remember to follow the help guidelines. This post will be automatically marked as dormant after 300 minutes of inactivity.
TIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here.
dan1st
dan1st2mo ago
Does nginx actually forward the requests to the server? How is it deployed? What is redirected to /login? I only see 404s
i hate SQL so much its unreal
when you said How is it deployed? what is it?
dan1st
dan1st2mo ago
the application
i hate SQL so much its unreal
its jar file
dan1st
dan1st2mo ago
Check whether nginx actually forwards the requests and where
i hate SQL so much its unreal
you mean this? "POST /bgw/sol/createPaymentInformation HTTP/1.1" 302 0 "-" "PostmanRuntime/7.43.0" "GET /login HTTP/1.1" 404 146 "http://myserver.lv/bgw/sol/createPaymentInformation" "PostmanRuntime/7.43.0"
dan1st
dan1st2mo ago
I meant the part between nginx and Spring I want to see what happens there This seems perfectly fine - is this not what you expect?
i hate SQL so much its unreal
thats correct
dan1st
dan1st2mo ago
Is this a request forwarded with nginx?
i hate SQL so much its unreal
um, i dont know. nginx is a thing for handling requests. so i guess yes or maybe i dont really understand ur question
dan1st
dan1st2mo ago
check it use Spring's logging to find out what request is retrieved using nginx
i hate SQL so much its unreal
thanks. i fixed it now. it was config inconsistency
JavaBot
JavaBot2mo ago
If you are finished with your post, please close it. If you are not, please ignore this message. Note that you will not be able to send further messages here after this post have been closed but you will be able to create new posts. 💤 Post marked as dormant
This post has been inactive for over 300 minutes, thus, it has been archived. If your question was not answered yet, feel free to re-open this post or create a new one. In case your post is not getting any attention, you can try to use /help ping. Warning: abusing this will result in moderative actions taken against you.

Did you find this page helpful?