我有Amazon S3对象,对于每个对象,我都设置了
Cache-Control: public, max-age=3600000
Run Code Online (Sandbox Code Playgroud)
那大概是41天.
我的Amazon CloudFront Distribution设置了最小TTL,也有3600000.
这是清除缓存后的第一个请求.
GET /1.0.8/web-atoms.js HTTP/1.1
Host: d3bhjcyci8s9i2.cloudfront.net
Connection: keep-alive
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
User-Agent: Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/29.0.1547.57 Safari/537.36
Accept-Encoding: gzip,deflate,sdch
Accept-Language: en-US,en;q=0.8
Run Code Online (Sandbox Code Playgroud)
而响应是
HTTP/1.1 200 OK
Content-Type: application/x-javascript
Content-Length: 226802
Connection: keep-alive
Date: Wed, 28 Aug 2013 10:37:38 GMT
Cache-Control: public, max-age=3600000
Last-Modified: Wed, 28 Aug 2013 10:36:42 GMT
ETag: "124752e0d85461a16e76fbdef2e84fb9"
Accept-Ranges: bytes
Server: AmazonS3
Age: 342557
Via: 1.0 6eb330235ca3971f6142a5f789cbc988.cloudfront.net (CloudFront)
X-Cache: Hit from cloudfront
X-Amz-Cf-Id: 92Q2uDA4KizhPk4TludKpwP6Q6uEaKRV0ls9P_TIr11c8GQpTuSfhw==
Run Code Online (Sandbox Code Playgroud)
即使亚马逊明确发送Cache-Control,Chrome仍然会发出第二个请求,而不是从Cache中读取它. …
google-chrome cache-control amazon-s3 http-headers amazon-cloudfront
Content-Type当没有有效负载体时,标头是否应出现在HTTP请求或响应中?
在这种情况下,HTTP标头的正确组合是否为0 Content-Type和Content-Length0,或者Content-Type当消息缺少正文时,是否应该不存在?
我知道有很多关于此的问题,但我无法让这个工作:
我想在multipart/form-data中将文件从输入上传到服务器
我尝试了两种方法.第一:
headers: {
'Content-Type': undefined
},
Run Code Online (Sandbox Code Playgroud)
这导致例如图像
Content-Type:image/png
Run Code Online (Sandbox Code Playgroud)
而它应该是multipart/form-data
和另外一个:
headers: {
'Content-Type': multipart/form-data
},
Run Code Online (Sandbox Code Playgroud)
但这要求一个边界标题,我相信不应该手动插入...
什么是解决这个问题的干净方法?我读过你能做到的
$httpProvider.defaults.headers.post['Content-Type'] = 'multipart/form-data; charset=utf-8';
Run Code Online (Sandbox Code Playgroud)
但我不希望我的所有帖子都是multipart/form-data.默认值应为JSON
资源被解释为文档但使用MIME类型text/css传输
这是Google Chrome Inspector中显示的错误.
该文件是:http://www.doanddare.org/css/style.css
它由php处理器呈现.
我该如何解决这个错误?
返回的标头是:
Accept:application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
Cache-Control:max-age=0
User-Agent:Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/534.3 (KHTML, like Gecko) Chrome/6.0.472.63 Safari/534.3
Run Code Online (Sandbox Code Playgroud)
HTTP/1.1 200 OK
Date: Sun, 10 Oct 2010 07:35:04 GMT
Server: Apache
content-style-type: text/css
Expires: Thu, 10 Oct 2030 03:50:23 GMT
Cache-Control: max-age=631138519, public
Content-Encoding: gzip
Vary: Accept-Encoding
Transfer-Encoding: chunked
Content-Type: text/css
Connection: Keep-Alive
Run Code Online (Sandbox Code Playgroud)
是否可以将请求标头作为文档发送,并将响应标头作为css文件返回?
如果是这样,我应该如何控制请求标头?
谢谢你的帮助.
我有一串原始HTTP,我想表示对象中的字段.有没有办法解析HTTP字符串中的各个标头?
'GET /search?sourceid=chrome&ie=UTF-8&q=ergterst HTTP/1.1\r\nHost: www.google.com\r\nConnection: keep-alive\r\nAccept: application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5\r\nUser-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_6; en-US) AppleWebKit/534.13 (KHTML, like Gecko) Chrome/9.0.597.45 Safari/534.13\r\nAccept-Encoding: gzip,deflate,sdch\r\nAvail-Dictionary: GeNLY2f-\r\nAccept-Language: en-US,en;q=0.8\r\n
[...]'
Run Code Online (Sandbox Code Playgroud) 我有一个URL,我正在使用HTTP GET将查询传递到页面.最新的味道(in net/http)会发生什么,该脚本不会超出302响应.我尝试了几种不同的解决方案; HTTPClient,net/http,Rest-Client,Patron ......
我需要一种方法来继续到最后一页,以验证页面html上的属性标记.重定向是由于移动用户代理点击重定向到移动视图的页面,因此标题中的移动用户代理.这是我今天的代码:
require 'uri'
require 'net/http'
class Check_Get_Page
def more_http
url = URI.parse('my_url')
req, data = Net::HTTP::Get.new(url.path, {
'User-Agent' => 'Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_3_2 like Mac OS X; en-us) AppleWebKit/533.17.9 (KHTML, like Gecko) Version/5.0.2 Mobile/8H7 Safari/6533.18.5'
})
res = Net::HTTP.start(url.host, url.port) {|http|
http.request(req)
}
cookie = res.response['set-cookie']
puts 'Body = ' + res.body
puts 'Message = ' + res.message
puts 'Code = ' + res.code
puts "Cookie \n" + cookie
end
end …Run Code Online (Sandbox Code Playgroud) 如果HTTP响应返回Expires和max-age指示哪一个使用?
Cache-Control: max-age=3600
Expires: Tue, 15 May 2008 07:19:00 GMT
Run Code Online (Sandbox Code Playgroud)
考虑到每个人都指的是不同的时间点.
也许我的浏览速度太快了,但是找不到具体记录.在我的特定情况下,我想知道"Content-Type"标题,但我假设相同的规则适用于其他标准标题.
这些是区分大小写的,如果是这样的话:它Content-Type还是Content-type?
有没有合适的地方可以参考这些?
我创建了一些jsp文件,作为响应返回一些json字符串.但我发现Content-Type自动设置为txt
我的jsp代码看起来像
<%@ page import="java.util.Random" %>
<%@ page language="java" %>
<%@ page session="false" %>
<%
String retVal = "// some json string";
int millis = new Random().nextInt(1000);
// System.out.println("sleeping for " + millis + " millis");
Thread.sleep(millis);
%>
<%=retVal%>
Run Code Online (Sandbox Code Playgroud)
我怎样才能表现出类似的东西
setHeader("Content-Type", "application/json");
Run Code Online (Sandbox Code Playgroud)
在这个例子中?
我试图将请求从一个localhost端口发送到另一个.我在后端的节点和节点上使用angularjs.
由于它是CORS请求,在node.js中,我正在使用
res.header('Access-Control-Allow-Origin', '*');
res.header('Access-Control-Allow-Methods', 'GET, POST, PUT, DELETE, PATCH');
res.header('Access-Control-Allow-Headers', 'Origin, X-Requested-With, Content-Type, Accept, Authorization');
Run Code Online (Sandbox Code Playgroud)
在angular.js服务文件中,我正在使用
return {
getValues: $resource(endpoint + '/admin/getvalues', null, {
'get': {
method: 'GET',
headers:{'Authorization':'Bearer'+' '+ $localStorage.token}
}
}),
}
Run Code Online (Sandbox Code Playgroud)
我收到以下错误
请求标头字段预检响应中的Access-Control-Allow-Headers不允许授权.
请帮忙!
http-headers ×10
http ×5
angularjs ×2
content-type ×2
amazon-s3 ×1
cors ×1
css ×1
curl ×1
file-upload ×1
http-caching ×1
httpclient ×1
java ×1
javascript ×1
jsp ×1
net-http ×1
node.js ×1
php ×1
python ×1
ruby ×1