我正在尝试使用 API v2 /upload 端点将文件上传到 Dropbox。有时我会收到来自 Dropbox 服务器的 413 错误响应(请求实体太大)。
不幸的是,文档中没有描述最大文件大小,也许有人知道吗?
我正在测试将图像文件上传到服务器的 REST Api。
图片太大,超过了最大请求正文大小,所以 Nginx 拒绝它并返回响应 413(请求实体太大)。
Nginx:错误日志
*329 客户端打算发送太大的正文:1432249 字节,客户端:xx.xx.xx.xx,服务器:api.example.com,请求:“POST /images HTTP/1.1”,主机:“api.example.com ", 推荐人: " https://example.com/posts/create "
但是,我发现 firefox/chrome 控制台说,
铬:控制台
CORS 策略已阻止从源“ https://example.com ”访问“ https://api.example.com/images ”处的 XMLHttpRequest :请求的资源。
CORS 和 413 错误之间有什么联系吗?这个消息来自哪里,为什么?
我正在使用react-use-hotjar,通过添加日志回调可以看到hotjar 已使用正确的站点ID 成功初始化,并且identifyHotjar调用也正常工作。但是,hotjar 仪表板中没有显示任何记录。
在网络选项卡中我可以看到;
POST https://ws3.hotjar.com/api/v2/sites/[my-site-id]/recordings/content => 413 Request Entity Too Large
该请求确实具有以下标头: Content-Length: 16748416
诚然,这看起来确实很大 - 但如果我将视频上传到 hotjar,我预计它会相当大 - 那么这个端点不会被配置为接受大的有效负载吗?
我还可以看到另一个失败的请求;
POST https://in.hotjar.com/api/v1/sites/[my-site-id]/deferred-page-content/[some-other-id] => 413
其中也有这个标题:content-length: 16331099- 再次相当大。
进一步的背景 - 我正在本地主机上运行此网站并通过本地隧道公开它- 我不确定这是否会产生影响
有人遇到过这个吗?我用 google 搜索过,但找不到其他人谈论 hotjar 的 413。
我们需要将大数据作为 URL 的一部分发送,这些数据将由 angular 读取以呈现页面。网址超过 10000 个字符。但是 cloudfront 返回以下错误 -
错误的请求。由 cloudfront (CloudFront) 生成请求 ID:I2fOApzZr4psKrWsY6abezp5R0m30zKDKE7c0MuB_JkjWbvxz5GVnQ==
浏览器控制台返回错误代码 413,并带有以下消息 -
加载资源失败:服务器响应状态为 413(请求实体太大)
云前端是否有任何设置可以允许接受大型 URL 请求。
我知道在 apache 上有像 LimitRequestBody 这样的设置可以允许大量输入,但是请求没有到达 apache 并且由 cloudfront 本身出错。
当我玩字符数时 - 在 8226 个字符后,cloudfront 中断。
我正在尝试通过使用base64进行图像检测从本地上传图像。
在本地主机和邮递员中一切正常。
但是在部署后,我收到了 CROS 错误。
我已经有了 cors 中间件 server.js
const express = require("express");
const cors = require("cors");
const bodyParser = require("body-parser");
const app = express();
app.use(cors());
app.use(bodyParser.json({ limit: "10000kb", extended: true }));
app.use(bodyParser.urlencoded({ limit: "10000kb", extended: true }));
Run Code Online (Sandbox Code Playgroud)
cors 中间件在使用 url 获取图像时工作正常,
但是当我尝试使用base64从本地上传图像时,控制台显示:
No 'Access-Control-Allow-Origin' header is present on the requested resource.
Run Code Online (Sandbox Code Playgroud)
这是我尝试过的解决方案:
App.js
const proxyUrl = 'https://cors-anywhere.herokuapp.com/';
fetch(proxyUrl + API_CALL.IMAGE_URL, {
method: 'post',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
inputLink: inputLink,
inputMethod: inputMethod
}), …Run Code Online (Sandbox Code Playgroud) 我已经看过人们遇到类似问题的帖子,但找不到明确的答案。
我尝试使用以下代码行检索 264735 个插槽的二维数组:
var optionalArguments = {majorDimension: "ROWS",
valueRenderOption: "FORMULA",
};
var sourceValuesObject = Sheets.Spreadsheets.Values.get(spreadsheetId, rangeA1Notation, optionalArguments)
Run Code Online (Sandbox Code Playgroud)
但这是我得到的:
响应代码:413。消息:响应太大。
这看起来很奇怪,因为我看不到这种限制写在任何地方,加上如果 300000 个或更少的单元格导致 API 错误,用户如何获取大量数据。
我尝试过拆分请求并且它有效,但这使我的代码变得更加复杂且速度更慢,而且在尝试将值更新回工作表范围时我得到空响应。
我指向正确的方向吗?这是正常的吗?有解决方法吗?
编辑: 这是一个示例电子表格
首先,我尝试使用循环Sheets.Spreadsheets.Values.get
内部来获取分割范围for,并且它有效。
做同样的事情batchGet会给我同样的错误,所以我想单元格内的数据太大了。
javascript google-apps-script http-status-code-413 google-sheets-api
当我的系统使用 okhttp3 发送 http 请求时,会出现以下问题:413 Request Entity Too Large
我想知道如何在 okhttp3 请求中设置最大大小,或者是否有其他解决方案来解决此问题。
public static String post(String url, String json) throws IOException {
OkHttpClient client = new OkHttpClient().newBuilder()
.readTimeout(1, TimeUnit.MINUTES)
.build();
RequestBody body = RequestBody.create(JSON, json);
Request request = new Request.Builder()
.header("Authorization", authKey)
.url(url)
.post(body)
.build();
try (Response response = client.newCall(request).execute()) {
if(response.code() != 200) {
return "request error";
}
return response.body().string();
}
}
Run Code Online (Sandbox Code Playgroud) 我在 IIS 上托管了用 laravel 编写的 WebAPI。我的一个请求大小为 60 MB。我试图将此数据发送到服务器,但收到 413 错误 - “请求实体太大”。
我更新了 php.ini 并设置了以下值
我还更新了IIS 服务器的uploadReadAheadSize并设置“80485760”
更新 php.ini 和服务器配置后,我重新启动了服务器。
我知道之前已经多次询问过这个问题,但我无法在我的配置中使用它。尝试上传大于默认 nginx 值client_max_body_sizewith 1 MB 的文件时出现 413 错误。
这是我的配置:
nginx.conf:
http {
client_max_body_size 500M;
limit_req_status 429;
limit_conn_status 429;
limit_req_zone $binary_remote_addr zone=worktoday:40m rate=10r/s;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
include /etc/nginx/mime.types;
default_type application/octet-stream;
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
gzip on;
gzip_disable "msie6";
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
}
Run Code Online (Sandbox Code Playgroud)
我的网站:
server {
client_max_body_size 500M;
listen 80;
location / {
client_max_body_size 500M;
proxy_pass http://backend;
proxy_set_header Host $host;
}
}
upstream backend {
client_max_body_size 500M;
least_conn;
server 172.16.10.10;
server 172.16.10.12; …Run Code Online (Sandbox Code Playgroud) 错误日志:
For pattern: EMB5216_DO/DEVELOPER/SCTF/OUT/* 23 artifacts were found.
17:32:52 Deploying artifact:http://192.168.5.2:9081/artifactory/LTEV5/SCTF/232/sctf_usdpaa_eth.so
17:32:52 Deploying artifact:http://192.168.5.2:9081/artifactory/LTEV5/SCTF/232/framework.so
17:32:52 Deploying artifact:http://192.168.5.2:9081/artifactory/LTEV5/SCTF/232/changefiles/HLPR_MP_changefiles.txt
17:32:53 Deploying artifact:http://192.168.5.2:9081/artifactory/LTEV5/SCTF/232/sctf_om.so
17:32:53 Deploying artifact: http://192.168.5.2:9081/artifactory/LTEV5/SCTF/232/sctf_dd_major.so
Response received: <html> <head><title>413 Request Entity Too Large</title></head> 17:32:53 <body bgcolor="white"> <center><h1>413 Request Entity Too Large</h1></center> <hr><center>nginx/1.11.8</center> </body> </html>
17:32:53 Failed while reading the response from: PUT http://192.168.5.2:9081/artifactory/LTEV5/SCTF/232/sctf_dd_major.so;vcs.revision=3f031a59068b91dfcc6647d44584f07a0c734f93;build.timestamp=1501665987574;build.name=LTEV5_SCTF;build.number=232 HTTP/1.1
17:32:53 ERROR: remote file operation failed: /opt/workspace/LTEV5_SCTF at hudson.remoting.Channel@18021228:Channel to /192.168.5.101: java.io.IOException: Failed to deploy file. Status code: 413
Run Code Online (Sandbox Code Playgroud)
ci系统中没有nginx服务器,无法修改nginx.conf来解决这个问题。
jenkins 版本:2.46.2
artifactory 插件版本:2.12.2
artifactory-oss 版本:4.14
多谢
我正在尝试调用Google Cloud函数来发送大于50Mb的图像。云功能的目的是调整图像大小并将其上传到Google云存储。
但是,当我将HTTP发布发送到我的云函数时,出现以下错误:413请求实体太大
有人对此错误有任何解决方法吗?我可以增加http请求的大小限制吗?
我有 2 个 WCF 服务一起工作。一种是类库,另一种是Web服务。
到目前为止它运行良好。但如果我尝试发送大量数据,它会抛出 413 错误......
An exception was thrown: The remote server returned an error: (413) Request Entity Too Large.
下面是 web.config 文件 -
对于类库-
Run Code Online (Sandbox Code Playgroud)<add key="SMTP" value ="dummy"/> <add key="BookingEmailFrom" value ="dummy"/> <add key="BookingEmailToWBD" value ="dummy"/> </appSettings> <connectionStrings/> <system.web> <compilation debug="true" targetFramework="4.0"/> <!-- The <authentication> section enables configuration of the security authentication mode used by ASP.NET to identify an incoming user. --> <authentication mode="Windows"/> <!-- The <customErrors> section enables configuration of what to do if/when an …
javascript ×2
nginx ×2
artifactory ×1
cors ×1
dropbox-api ×1
firebase ×1
flask ×1
hotjar ×1
http ×1
iis ×1
java ×1
jenkins ×1
localtunnel ×1
node.js ×1
okhttp ×1
php ×1
reactjs ×1
request ×1
web ×1
web-services ×1