账户登录
This commit is contained in:
1 parent
3b555ae815
commit
5d9b9d21b4
2 files changed
+12
-6
No files matched your search
@@ -7,14 +7,17 @@ import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import java.nio.file.Paths;
|
||||
|
||||
/** 运营后台本地开发 Web 配置。 */
|
||||
/** 运营后台 Web 配置。 */
|
||||
@Configuration
|
||||
public class AdminWebConfig implements WebMvcConfigurer {
|
||||
/** 本地媒体上传目录。 */ @Value("${shoplix.media.upload-dir:./uploads}") private String uploadDir;
|
||||
/** 允许本地运营前端调用后台接口。 */
|
||||
/** 允许本地和测试环境运营前端调用后台接口。 */
|
||||
@Override
|
||||
public void addCorsMappings(CorsRegistry registry) {
|
||||
registry.addMapping("/api/admin/**").allowedOrigins("http://localhost:5173", "http://127.0.0.1:5173")
|
||||
registry.addMapping("/api/admin/**").allowedOrigins(
|
||||
"http://localhost:5173",
|
||||
"http://127.0.0.1:5173",
|
||||
"https://admin.steliro.com")
|
||||
.allowedMethods("GET", "POST", "PUT", "DELETE", "OPTIONS").allowCredentials(true);
|
||||
}
|
||||
/** 暴露本地开发媒体资源。 */ @Override public void addResourceHandlers(ResourceHandlerRegistry registry){registry.addResourceHandler("/uploads/**").addResourceLocations(Paths.get(uploadDir).toAbsolutePath().normalize().toUri().toString());}
|
||||
|
||||
Reference in new issue
Block a user