Spring boot redirect not working

Hi All,

I have created one Jira Plugin using spring boot and angular in front-end. when I uploading app to Jira Software it is getting upload and also user is getting authenticated but as I am using angular I have to forward it’s page to index.html which I do as follow:

@Controller
public class Html5PathsController {


    @RequestMapping(value = "/**/{path:[^\\.]*}")
    public String forward() {
        return "forward:/index.html";
    }
}

This is working and my login page gets displayed but when I am trying to make any rest request from my application for e.g “/app/getuserlocation” it is giving me 401 error not sure I anyone can help will be really great.



@WebFilter("/*")
public class AuthFilter implements Filter {

    Properties p = null;

    @Override
    public void init(FilterConfig filterConfig) throws ServletException {
        try {
            p = PropertiesLoaderUtils.loadProperties(new ClassPathResource("filters.properties"));
            AuditLoggerUtil.log(AuditLoggerUtil.CORELOGGER, AuditLoggerUtil.DEBUG, this, "AuthFilter init", null);
        } catch (Exception e) {
            AuditLoggerUtil.log(AuditLoggerUtil.CORELOGGER, AuditLoggerUtil.ERROR,
                    AuthFilter.class, "Error while reading Cross origin", e);
        }
    }

    @Override
    public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
        try {
            HttpServletRequest req = (HttpServletRequest) request;
            HttpServletResponse res = (HttpServletResponse) response;


                if (isAUth(req,res)) {
				res.sendRedirect(  "https://" + req.getServerName()
                             + "/app/sso_login?e=" + CommonUtils.toHexString(ja1.toString().getBytes(StandardCharsets.UTF_8)));
                    chain.doFilter(request, response);
                } else {
                    return;
                }


        } catch (Exception e) {
            
        }
    }

    public boolean isAUth(HttpServletRequest req, HttpServletResponse res) {
        Authentication auth = SecurityContextHolder.getContext().getAuthentication();
       /* Optional<AtlassianHostUser> optionalHostUser = Optional.ofNullable(SecurityContextHolder.getContext().getAuthentication())
                .map(Authentication::getPrincipal)
                .filter(AtlassianHostUser.class::isInstance)
                .map(AtlassianHostUser.class::cast);
        System.out.println(optionalHostUser.get());*/
        return auth.isAuthenticated();
    }

   


    @Override
    public void destroy() {
        Filter.super.destroy();
    }
}

And this is my Filter which gives authenticated as true. then why rest request to my local application not working