Created
July 8, 2018 13:20
-
-
Save topera/910005f64dfd9abe1ccee726c6ef2d12 to your computer and use it in GitHub Desktop.
Controller for springboot that redirects any url to /
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Controller | |
public class ForwardingController { | |
@RequestMapping("/**/{path:[^\\.]+}") | |
public String forward() { | |
// path: checks only the path of url | |
// [^\.]: any char, except literal dot (because if the url is foo.css (for example) we don't want to redirect) | |
return "forward:/"; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment