【问题标题】:How can I get past a 502 proxy error when uploading a file via JMeter?通过 JMeter 上传文件时如何解决 502 代理错误?
【发布时间】:2023-02-07 15:19:45
【问题描述】:

我正在尝试设置 JMeter 5.5 以将文件上传到我们的系统,就好像它发生在用户界面中一样,但我继续收到 502 代理错误。如何让文件上传成功?

我正在使用参数 hivUpload。如果我将参数从 hivUpload 更改为其他任何参数,我会收到 500 错误而不是 502,因此我认为 hivUpload 是正确的参数。

我在 JMeter bin 文件夹中有该文件,但不清楚是否需要包含完整文件路径。两种方法我都试过了,都没有成功。

Setup

Results

Source file location

要求

POST https://cdc-ew.lutherhq1b.int/rest/v1/upload

POST data:
--s6kF9JKRBTVi1qsnV4rm1hbf6gd6HMeH62
Content-Disposition: form-data; name="hivUpload"; filename="AgencyInfo 2_0 - good file.xml"
Content-Type: application/xml
Content-Transfer-Encoding: binary

<actual file content, not shown here>
--s6kF9JKRBTVi1qsnV4rm1hbf6gd6HMeH62--


[no cookies]

回复

 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>502 Proxy Error</title>
</head><body>
<h1>Proxy Error</h1>
<p>The proxy server received an invalid
response from an upstream server.<br />
The proxy server could not handle the request<p>Reason: <strong>Error reading from remote server</strong></p></p>
</body></html>

通过发送 JSON 请求,我能够让其他进程成功进行,就好像我在进行数据输入一样。请注意结果中成功的绿色条目,因此我相信所有其他项目都已正确设置。但是,我们之前没有尝试过使用JMeter上传文件。我知道这样做是可能的,我看过有关它的文章(比如这篇https://artoftesting.com/fileuploadinjmeter#:~:text=File%20upload%20in%20JMeter%20will,checkbox%20in%20HTTP%20Request%20sampler.),但我不清楚我需要在我的设置中调整什么。

【问题讨论】:

    标签: file-upload jmeter upload jmeter-5.0


    【解决方案1】:

    我们无法对您的配置发表评论,因为我们不知道需要提供多少文件,因为有多种上传文件的方法。

    您可以尝试使用 JMeter 的 HTTP(S) Test Script Recorder 进行录制,只需确保您上传的文件位于 JMeter 安装的“bin”文件夹中,只有这样 JMeter 才能拦截请求并生成正确的 HTTP Request采样器和HTTP Header Manager

    更多资讯:JMeter Performance Testing: Upload and Download Scenarios

    【讨论】:

      猜你喜欢
      • 2013-11-19
      • 2018-03-31
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-03-12
      • 2023-01-18
      • 1970-01-01
      相关资源
      最近更新 更多