# 请求用户自定义头像时返回 500

**URL:** <https://meta.discourse.org/t/returning-500-when-requesting-users-custom-avatars/384454>\
**Category:** Support\
**Tags:** unsupported-install, s3, users\
**Created:** [2025年十月1日 10:21 UTC](https://meta.discourse.org/t/returning-500-when-requesting-users-custom-avatars/384454 "2025-10-01T10:21:35Z")\
**Posts on this page:** 1\
**Showing post:** 9

<div class="post-metadata">

**Author:** ![MoRanYue](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/moranyue/32/523065_2.png) [@MoRanYue](https://meta.discourse.org/u/MoRanYue)\
**Post date:** [2025年十月4日 05:11 UTC](https://meta.discourse.org/t/returning-500-when-requesting-users-custom-avatars/384454/9 "2025-10-04T05:11:12Z")

</div>

@avidseeker  
当您使用 OSS 服务而您的服务器无法访问它时，例如，您在中国，而您服务器到 Cloudflare R2 的连接被本地 ISP 阻止。当客户端尝试获取自定义头像资源时，您的服务器必须从 OSS 获取，但失败，然后向客户端返回 500。

在我的例子中，设置两个环境变量：`HTTP_PROXY` 和 `HTTPS_PROXY` 指向一个能够访问您的 OSS 服务的代理服务器。如果您使用标准安装方式安装 Discourse，在您的 `app.xml` 中应该有一个名为 `env` 的字段，添加这两个变量，然后您就可以运行了。我使用了不受支持的安装方式，并使用 Systemd 来管理 Discourse，所以我向 `.service` 文件中添加了两个 `Environment` 参数。

我不知道您的国家是否有网络审查系统。如果有，我可以假设您已经知道该怎么做；如果没有，请检查您的 OSS 服务的在线状态以及您关于 S3 的设置。

---

_[View the full topic](https://meta.discourse.org/t/returning-500-when-requesting-users-custom-avatars/384454)._
