尝试访问索引时出现本地主机问题

问题描述 投票:0回答:1

尝试通过

http://localhost:8080/index
测试我部署的 Springboot 应用程序,它总是会将我重定向到 http://localhost:8080/login,我现在不知道它是什么.

我的应用程序成功启动,没有任何错误,控制器类如下:

package com.spirosvatikiotis.fleetapp;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;

@Controller
public class ApplicationController {

    @GetMapping("/index")
    public String goHome() {
        return "index";
    }
}

这与cookies有关吗?

spring-boot redirect indexing localhost
1个回答
1
投票

您已启用 Spring 安全性。您被重定向到 /login,因为您没有访问 /index 的权限。

完全禁用安全性或在 /login 上启用未经身份验证的请求。

© www.soinside.com 2019 - 2024. All rights reserved.