将项目网址重定向到自定义域

我将项目发布到GitLab Pages并添加我的自定义域。现在,我想将默认的GitLab URL package com.example.springbootdemo.controllers; import com.example.springbootdemo.model.Box; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RestController; import com.example.springbootdemo.repositories.BoxRepository; @RestController public class BoxController { @Autowired BoxRepository boxrepository; @PostMapping("/box") public Box addBox(Box box){ return this.boxrepository.save(box); } } 重定向到我的域名username.gitlab.io/project。我在DNS中添加了两条记录,如下所示:

mydomain.com

但是没用。我该怎么办?

weikai0960 回答:将项目网址重定向到自定义域

如果您查看一个网址,例如:http://example.net/foo/bar域名仅 example.net部分。

DNS仅控制域名,因此您将无法使用CNAME记录指向目标域上的子目录。

要执行类似的操作,您将需要一个Web服务器来代理对该目录的请求。 (搜索nginx反向代理的示例)

本文链接:https://www.f2er.com/3166686.html

大家都在问