When uploading an avatar in Lemmy, the following error appears in the bottom left corner:
Error Message
Browser error message:
{"data":{"error":"unknown","message":"error decoding response body: EOF while parsing a value at line 1 column 0"},"state":"success"}
Response status code: 400
Cause of the Problem
Based on the error message, it is speculated to be a network issue. Upon inspecting the docker-compose
configuration, a http proxy testing configuration added a few days ago was discovered. After removing the proxy, the image upload worked normally.
Solutions
Quick Fix: Repair the Network
If there is a network proxy, simply repairing the network connection should resolve the issue.
Perfect Solution: Optimize Network Proxy Configuration
A network proxy can hide the real request IP of the server. Without losing the proxy, local services affected can be excluded using no_proxy
.
The final network proxy configuration in docker-compose.yml
is as follows:
environment:
- http_proxy=192.168.x.x:xxxx
- no_proxy="lemmy,localhost,127.0.0.1,postgres,pictrs,0.0.0.0"
报错信息
浏览器报错信息
{"data":{"error":"unknown","message":"error decoding response body: EOF while parsing a value at line 1 column 0"},"state":"success"}
Response status code: 400
问题原因
通过报错信息推测是网络问题,排查
docker-compose
配置发现,前几天加了一行http proxy代理测试配置,移除代理后图片上传正常。解决方法
简单解决:修复网络
如果上游有网络代理,修复网络连接即可。
完美解决:优化网络代理配置
网络代理可以隐藏服务器的真实请求IP,在不缺失代理的前提下,可以通过
no_proxy
排除掉本地受影响服务。最终通过
docker-compoe.yml
配置网络代理配置如下:environment: - http_proxy=192.168.x.x:xxxx - no_proxy="lemmy,localhost,127.0.0.1,postgres,pictrs,0.0.0.0"