问题描述:
一个ajax请求失败,在浏览器的表现是HTTP request Headers中有provisional headers are shown,而且在network选项卡中,显示网络请求status为failed。首先按照网络上的解释出现provisional headers are shown 表明当前请求的数据并没有发送到服务器端(实际并不是如此)
出现上述问题一般有两种原因:
1. 请求从缓存中取数据
2. 请求由于某些原因被中断,例如:在iframe中ajax请求发送之前,iframe被删除;在form表单提交同时ajax也发出请求;还有就是ajax请求超时;
但是通过代码并没有发现上述两点问题,接着按照网络上说的使用chrome自带的工具去查看具体的网络请求事件。
在浏览器中输入chrome://net-internals,找到event选项
查看event记录: 看粗体部分
237851: URL_REQUEST
http://pay.gyyx.cn/GyyxCardPay/PayGYB?r=0.519311266924479
Start Time: 2017-09-22 15:51:35.169
t=12472482 [st= 0] +REQUEST_ALIVE [dt=51]
--> priority = "HIGHEST"
--> url = "http://pay.gyyx.cn/GyyxCardPay/PayGYB?r=0.519311266924479"
t=12472483 [st= 1] URL_REQUEST_DELEGATE [dt=0]
t=12472483 [st= 1] +URL_REQUEST_START_JOB [dt=50]
--> load_flags = 49408 (IGNORE_LIMITS | MAYBE_USER_GESTURE | VERIFY_EV_CERT)
--> method = "POST"
--> upload_id = "0"
--> url = "http://pay.gyyx.cn/GyyxCardPay/PayGYB?r=0.519311266924479"
t=12472483 [st= 1] URL_REQUEST_DELEGATE [dt=0]
t=12472483 [st= 1] HTTP_CACHE_GET_BACKEND [dt=0]
t=12472483 [st= 1] +HTTP_STREAM_REQUEST [dt=0]
t=12472483 [st= 1] HTTP_STREAM_JOB_CONTROLLER_BOUND
--> source_dependency = 237853 (HTTP_STREAM_JOB_CONTROLLER)
t=12472483 [st= 1] HTTP_STREAM_REQUEST_BOUND_TO_JOB
--> source_dependency = 237854 (HTTP_STREAM_JOB)
t=12472483 [st= 1] -HTTP_STREAM_REQUEST
t=12472483 [st= 1] +UPLOAD_DATA_STREAM_INIT [dt=0]
t=12472483 [st= 1] UPLOAD_DATA_STREAM_INIT [dt=0]
--> is_chunked = false
--> net_error = 0 (?)
--> total_size = 195
t=12472483 [st= 1] -UPLOAD_DATA_STREAM_INIT
--> is_chunked = false
--> net_error = 0 (?)
--> total_size = 195
t=12472483 [st= 1] +HTTP_TRANSACTION_SEND_REQUEST [dt=1]
t=12472483 [st= 1] HTTP_TRANSACTION_SEND_REQUEST_HEADERS
-->[b] POST http://pay.gyyx.cn/GyyxCardPay/PayGYB?r=0.519311266924479 HTTP/1.1
Host: pay.gyyx.cn
Proxy-Connection: keep-alive
Content-Length: 195
Accept: application/json, text/javascript, */*; q=0.01
Origin: http://pay.gyyx.cn
X-Requested-With: XMLHttpRequest
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.101 Safari/537.36
Content-Type: application/x-www-form-urlencoded; charset=UTF-8
Referer: http://pay.gyyx.cn/gamepay/paygyb
Accept-Encoding: gzip, deflate
Accept-Language: zh-CN,zh;q=0.8
Cookie: [352 bytes were stripped][/b]
t=12472484 [st= 2] HTTP_TRANSACTION_SEND_REQUEST_BODY
--> did_merge = false
--> is_chunked = false
--> length = 195
t=12472484 [st= 2] +UPLOAD_DATA_STREAM_READ [dt=0]
--> current_position = 0
t=12472484 [st= 2] UPLOAD_DATA_STREAM_READ [dt=0]
--> current_position = 0
t=12472484 [st= 2] -UPLOAD_DATA_STREAM_READ
t=12472484 [st= 2] UPLOAD_DATA_STREAM_READ [dt=0]
--> current_position = 195
t=12472484 [st= 2] -HTTP_TRANSACTION_SEND_REQUEST
t=12472484 [st= 2] +HTTP_TRANSACTION_READ_HEADERS [dt=48]
t=12472484 [st= 2] HTTP_STREAM_PARSER_READ_HEADERS [dt=47]
t=12472531 [st=49] HTTP_STREAM_PARSER_READ_HEADERS [dt=1]
t=12472532 [st=50] HTTP_STREAM_PARSER_READ_HEADERS [dt=0]
t=12472532 [st=50] HTTP_STREAM_PARSER_READ_HEADERS [dt=0]
t=12472532 [st=50] HTTP_STREAM_PARSER_READ_HEADERS [dt=0]
t=12472532 [st=50] HTTP_STREAM_PARSER_READ_HEADERS [dt=0]
t=12472532 [st=50] HTTP_STREAM_PARSER_READ_HEADERS [dt=0]
t=12472532 [st=50] HTTP_STREAM_PARSER_READ_HEADERS [dt=0]
t=12472532 [st=50] HTTP_STREAM_PARSER_READ_HEADERS [dt=0]
t=12472532 [st=50] HTTP_STREAM_PARSER_READ_HEADERS [dt=0]
t=12472532 [st=50] HTTP_STREAM_PARSER_READ_HEADERS [dt=0]
t=12472532 [st=50] HTTP_STREAM_PARSER_READ_HEADERS [dt=0]
t=12472532 [st=50] HTTP_STREAM_PARSER_READ_HEADERS [dt=0]
t=12472532 [st=50] HTTP_STREAM_PARSER_READ_HEADERS [dt=0]
t=12472532 [st=50] HTTP_STREAM_PARSER_READ_HEADERS [dt=0]
t=12472532 [st=50] HTTP_STREAM_PARSER_READ_HEADERS [dt=0]
t=12472532 [st=50] HTTP_STREAM_PARSER_READ_HEADERS [dt=0]
t=12472532 [st=50] HTTP_STREAM_PARSER_READ_HEADERS [dt=0]
t=12472532 [st=50] HTTP_STREAM_PARSER_READ_HEADERS [dt=0]
t=12472532 [st=50] HTTP_STREAM_PARSER_READ_HEADERS [dt=0]
t=12472532 [st=50] HTTP_STREAM_PARSER_READ_HEADERS [dt=0]
t=12472532 [st=50] HTTP_STREAM_PARSER_READ_HEADERS [dt=0]
t=12472532 [st=50] HTTP_STREAM_PARSER_READ_HEADERS [dt=0]
t=12472532 [st=50] HTTP_STREAM_PARSER_READ_HEADERS [dt=0]
t=12472532 [st=50] HTTP_STREAM_PARSER_READ_HEADERS [dt=0]
t=12472532 [st=50] HTTP_STREAM_PARSER_READ_HEADERS [dt=0]
t=12472532 [st=50] HTTP_STREAM_PARSER_READ_HEADERS [dt=0]
t=12472532 [st=50] HTTP_STREAM_PARSER_READ_HEADERS [dt=0]
t=12472532 [st=50] HTTP_STREAM_PARSER_READ_HEADERS [dt=0]
t=12472532 [st=50] HTTP_STREAM_PARSER_READ_HEADERS [dt=0]
t=12472532 [st=50] HTTP_STREAM_PARSER_READ_HEADERS [dt=0]
t=12472532 [st=50] HTTP_STREAM_PARSER_READ_HEADERS [dt=0]
t=12472532 [st=50] HTTP_STREAM_PARSER_READ_HEADERS [dt=0]
t=12472532 [st=50] HTTP_STREAM_PARSER_READ_HEADERS [dt=0]
t=12472532 [st=50] HTTP_STREAM_PARSER_READ_HEADERS [dt=0]
t=12472532 [st=50] HTTP_STREAM_PARSER_READ_HEADERS [dt=0]
t=12472532 [st=50] HTTP_STREAM_PARSER_READ_HEADERS [dt=0]
t=12472532 [st=50] HTTP_STREAM_PARSER_READ_HEADERS [dt=0]
t=12472532 [st=50] HTTP_STREAM_PARSER_READ_HEADERS [dt=0]
t=12472532 [st=50] HTTP_TRANSACTION_READ_RESPONSE_HEADERS
-->[b] HTTP/1.1 302 Found
Content-Length: 189
Cache-Control: private
Content-Type: text/html; charset=utf-8
Date: Fri, 22 Sep 2017 07:51:36 GMT
Gy-Log-Id: vQN3u2-8a902410711a9-029-3MziEf-8afcd
Keep-Alive: timeout=38
Location: http://static.gyyx.cn/error/index.html?aspxerrorpath=/GyyxCardPay/PayGYB
Server: Microsoft-IIS/7.5
Set-Cookie: [55 bytes were stripped]
X-Aspnet-Version: 4.0.30319
X-Aspnetmvc-Version: 4.0
X-Powered-By: ASP.NET[/b]
t=12472532 [st=50] -HTTP_TRANSACTION_READ_HEADERS
t=12472532 [st=50] URL_REQUEST_DELEGATE [dt=0]
t=12472532 [st=50] URL_REQUEST_DELEGATE [dt=1]
t=12472533 [st=51] [b]CANCELLED[/b]
t=12472533 [st=51] -URL_REQUEST_START_JOB
--> [b]net_error = -3 (ERR_ABORTED)[/b]
t=12472533 [st=51] URL_REQUEST_DELEGATE [dt=0]
t=12472533 [st=51] -REQUEST_ALIVE
从中可以看到前边有正常的请求数据, 继续往后看在最后边有一个网络响应而且使从服务器端返回来的。 此处竟然有302网络响应结果返回,那么问题来了。 怎么会表现为状态为failed而不是302呢? 302这个状态在上述日志中只是一个中间结果,在日志的最后可以看到请求被CANCELLED以及ERR_ABORTED了。 具体啥原因,先不研究了。
既然返回了302,那么一定是服务器端发生了异常。 经确认的确是服务端数据错误,导致服务器给出了302的信息。
总结:
在浏览器中发现provisional headers are shown,也并不一定就说明问题只在前端不在服务器端。
分享到:
相关推荐
在微信小程序开发中,图片上传是一项基础且重要的功能,它涉及到用户交互以及数据传输。本文将详细介绍微信小程序中如何实现图片上传以及服务端如何接收这些上传的图片。 首先,微信小程序提供了`wx.chooseImage` ...
Python爬虫技术是用于自动化获取网页数据的一种方法,尤其在数据挖掘、数据分析等领域广泛应用。本文将探讨如何使用Python来爬取当当、京东、亚马逊这三个知名电商平台上的图书信息。 首先,要实现这个功能,我们...
This application has no explicit mapping for /error, so you are seeing this as a fallback. Wed Jan 23 15:20:18 CST 2019 There was an unexpected error (type=Internal Server Error, status=500). An error...
CAUTION:Provisional headers are shown, 解决方法: manifest.appcache配置文件中NETWORK:需要配置*, CACHE MANIFEST # 2015-02-21 v1.0.2 /test.html NETWORK: * 星号来指示所有为缓存的其他文件都需要...
标题“PCBM_LP_Provisional_V702”指的是一个特定版本的PCB设计辅助工具,主要用于创建符合IPC-7351标准的PCB封装。这个软件版本为V702,暗示了它可能已经经过多次迭代和优化,以提供更好的功能和用户体验。 在描述...
M_LP_Provisional_V2009破解版,做PCB库的好帮手!!听说破解的不是很完善,自己注意点
PCB ILP7351 Provisional V702 完美破解版本,做PCB封装优秀软件,不容错过!
Node.js 是一个基于Chrome V8引擎的JavaScript运行环境,它为开发者提供了一个强大的服务器端JavaScript解决方案。在Node.js中处理JSON数据是常见的任务,而`inspect-json`工具就是这样一个实用程序,它允许开发者...
支持的软件有: allegro aitilm designer board station cadstar eagle expediton mcCAD NI Ultiboard orcad layout orcad pcbeditor pads layout pads ascii pantheon p-cad protel 99se ...zuken cr5000
用于allegro的封装制作,业内人士知道的!
《PCBM_LP_Provisional_V702_Setup——打造高效便捷的PCB封装生成工具》 在电子设计领域,PCB(Printed Circuit Board)的设计是至关重要的环节,而其中封装的创建更是设计师们必须面对的一项基础工作。PCBM_LP_...
US_Provisional Life Expectancy Estimates for 2020
整个过程,不需要计算尺寸。只需原封不动的,将手册上的尺寸抄录过来,即可生成PCB封装。 而且保证焊盘设计的可焊接性。几乎不会出错。
PCBM_LP_Provisional_V2009破解版
M_LP_Provisional_V2009破解版,做PCB库的好帮手!!听说破解的不是很完善,自己注意点
【船级社】 LR Provisional Rules and Regulations for Software to be used in Naval Ships 2020-01 [.pdf