404 将图像附加到 GitLab Wiki 页面时出错

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

我们有一个在 Docker 容器中运行的自托管 GitLab 服务器,除了将图像(可能还有任何文件)附加到项目 Wiki 页面之外,一切看起来都工作正常。在 WebUI 中,它在尝试附加图像后报告了

404 Project Not Found
错误,并深入查看日志文件,我可以看到以下内容:

Started POST "/api/v4/projects/124/wikis/attachments" for <my-ip> at 2024-01-24 12:36:21 +0000

Processing by Gitlab::RequestForgeryProtection::Controller#index as JSON

Parameters: {"file.name"=>"image.png", "file.path"=>"/opt/gitlab/embedded/service/gitlab-rails/public/uploads/tmp/image.png485432037", "file.size"=>"44057", "file.md5"=>"<md5>", "file.sha1"=>"<sha1>", "file.sha256"=>"<sha256>", "file.sha512"=>"<sha512>", "file"=>#<UploadedFile:0x00007f7f42950a38 @tempfile=#<File:/var/opt/gitlab/gitlab-rails/uploads/tmp/image.png485432037>, @size=44057, @content_type="application/octet-stream", @original_filename="image.png", @sha256="<sha256>", @remote_id=nil>}

Can't verify CSRF token authenticity.

This CSRF token verification failure is handled internally by `GitLab::RequestForgeryProtection`

Unlike the logs may suggest, this does not result in an actual 422 response to the user

For API requests, the only effect is that `current_user` will be `nil` for the duration of the request

Completed 422 Unprocessable Entity in 1ms (ActiveRecord: 0.0ms | Elasticsearch: 0.0ms)

从我在网上能够确定的情况来看,CSRF用于确保客户端正在与预期的主机通信,这让我认为CSRF令牌不同步?

提供一些历史记录,这似乎只是在我们从一台服务器迁移到另一台服务器之后才开始发生:

  • 新的主机服务器已启动,GitLab“运行时”文件从旧服务器复制到新服务器
  • 使用复制的“运行时”文件并从原始服务器运行相同的 docker 命令在新服务器上重新创建了 Docker 映像/容器

据我所知,其他一切看起来都正常。可以执行远程 Git 操作(通过命令行以及 IDE),可以创建/修改/删除 Wiki 页面,并且可以通过 WebUI 执行预期的项目操作。仅将图像附加到维基页面似乎不起作用......

docker gitlab csrf
1个回答
0
投票

和我有同样的问题。你找到解决办法了吗?

最新问题
© www.soinside.com 2019 - 2024. All rights reserved.