aws / aws/apprunner-roadmap

response.redirect not working correctly in AppRunner

Open
#76 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
No language data
Stars
301
Forks
15
PR merge metrics
No merged PRs in 30d

Description

Hello below are two sample projects that I deployed on AppRunner

https://e4uza2pwdx.us-east-1.awsapprunner.com/
https://wrwfnqs9en.us-east-1.awsapprunner.com/

However in both the projects, I am facing one common issue. And after some debugging I realized that AppRunner is not allowing me to do redirect i.e. response.redirect that we usually do. Wanted to understand if this is due to any specific hardening done in AppRunner. I deployed these containers on ECS and EKS and local docker, everything works perfect.

Just in AppRunner I am getting this issue that it is not allowing me to redirect. Not sure if I may be missing something.

Some code snippet which is not working:

@PostMapping("/adduser")
public String addUser(@Valid User user, BindingResult result, Model model) {
System.out.println("inside addUser");

if (result.hasErrors()) {
System.out.println("inside result has errors");
return "add-user";
}

userRepository.save(user);
System.out.println("after persisting to repo");
return "redirect:/";
}

@PostMapping("/update/{id}")
public String updateUser(@PathVariable("id") long id, @Valid User user, BindingResult result, Model model) {
System.out.println("inside updateUser");
if (result.hasErrors()) {
user.setId(id);
return "update-user";
}
userRepository.save(user);
return "redirect:/index";
}

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.