Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting 302 Found when i invoke from alb but from api gateway its returning response properly #423

Open
shashikalagt opened this issue Aug 25, 2021 · 5 comments

Comments

@shashikalagt
Copy link

shashikalagt commented Aug 25, 2021

To help us debug your issue fill in the basic information below using the options provided

Serverless Java Container version: 1.6

Implementations: Spring Boot 2

Framework version: SpringBoot 2.2.1.RELEASE

Frontend service: ALB

Deployment method: Console

Scenario

currently spring boot app running in eks need to to deploy to lambda as containeter, image, the image is deployed suceessfully, when i invoke from api gateway test console, getting exepected results, but when i configure alb and lambda as the target, getting 302 Found, using custom doamin name

Expected behavior

It has to return the same response how api gateway returns

Actual behavior

302 Found

Steps to reproduce

as its official can't provide

Full log output

2021-08-30 10:28:58.413 INFO 6 --- [ main] c.a.s.p.internal.LambdaContainerHandler : 127.0.0.1 null- null [30/08/2021:10:28:58Z] "POST /dataloader/xxx/start/job null" 302 - "-" "PostmanRuntime/7.28.4" combined

Server: awselb/2.0
Date: Mon, 30 Aug 2021 10:28:58 GMT
Content-Type: application/octet-stream
Content-Length: 0
Location: https://xxxx/dataloader/xxx/start/job?synchronous=true
Connection: keep-alive

logs
@deki
Copy link
Collaborator

deki commented Aug 27, 2021

Hi @shashikalagt, please add more details and fill out the issue template so that we are able to help you. Thanks!

@shashikalagt
Copy link
Author

i have updated the details

@shashikalagt
Copy link
Author

Hi @shashikalagt, please add more details and fill out the issue template so that we are able to help you. Thanks!

The issue is resolved, when i disable requireSecure in oAuth config

http.cors().and().authorizeRequests()
.antMatchers(matcher)
.permitAll().and().authorizeRequests().antMatchers("/**").authenticated().and().sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS)
;//.and().requiresChannel().anyRequest().requiresSecure();

@shashikalagt
Copy link
Author

I have referred this link and disabled the above line for workround, please suggest what we need to do in case security conext
https://community.pivotal.io/s/article/spring-boot-app-keeps-returning-http-status-code-302?language=en_US

@deki
Copy link
Collaborator

deki commented Sep 1, 2021

Thanks for updating the issue with your findings. Take a look if the x-forwarded headers are correctly transmitted.

You can modify the configuration as documented: https://docs.spring.io/spring-boot/docs/current/reference/html/howto.html#howto.webserver.use-behind-a-proxy-server

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants