Answer the question
In order to leave comments, you need to log in
Why doesn't spring boot return Angular 5 pages by url?
Hello! Dear toasters, what's the problem? Spring Boot is written by API, Angular 5 front. It's time for deployment. I built the project in Spring Boot resources/static/* everything works, cheers. But when you reload the page, Sping Security is triggered and says that the url is not very good and the client logic sometimes does not work, as if the scripts were not loaded. Details on screenshots.
Put ignore for files.
Launched - works. But when I switch not to "/" but let's say "/signin" and reload F5. then I get 401. As if I'm not stepping on Angular, but on an API to which I do not have access.
You can see what the problem is with GIF here VIEW GIF .
Answer the question
In order to leave comments, you need to log in
Solution.
package by.psu.controllers;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
@Controller
public class ViewController {
@RequestMapping(value = "/**/{[path:[^\\.]*}")
public String redirect() {
return "forward:/";
}
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question