Articles of http headers

Google云存储公共对象caching在服务器端

我有一个具有所有用户读取权限的Google桶,但没有configuration为网站(也没有归档)。 即使发送请求时没有caching控制,我也遇到了对象caching: gsutil cp test gs://mybucket # test has default meta Cache-Control: public, max-age=3600 wget -S –no-cache http://storage.googleapis.com/mybucket/test # OK saved as test gsutil rm gs://mybucket/test wget -S –no-cache http://storage.googleapis.com/mybucket/test # Saved as test.1, why? 在对象删除服务器时间之后,我运行了wget –no-cache 。 它有时会返回caching的test文件,有时会正确地使用HTTP 404.我已经运行Google计算引擎Ubuntu服务器中的命令,但没有configurationcaching。 Google云以外的几台机器也有同样的结果。 IMO服务器必须始终返回HTTP 404。 这是Google云基础架构错误吗? 注意:当我设置对象meta Cache-Control:no-cache它按预期工作。 但是我认为服务器不应该为wget –no-cache返回caching的内容,即使它具有默认的元素Cache-Control:no-cache

我们能configurationHTTP响应代docker吗?

我们被困住了。 在我们没有预料到的Apache httpd + Passenger Web服务器中,我们得到了一个新的头文件。 我们有一个敏感的networking客户端阅读这个我们现在不能修改。 我们可以修改这个标题吗? 据我们所知,“OK”是规范的一部分。 我们希望修改标题,使其包含规范的所有预期部分。 我们在期待: "HTTP/1.1 200 OK" 但反而得到: "HTTP/1.1 200 "

无法让nginx用压缩的内容回复ab

ab -n 1 -H 'Accept-Encoding: gzip, deflate' http://mywebsite.com/ 这总是返回未压缩的内容(我可以看到,从它的大小,因为我用ngrep嗅探stream量)。 但是,如果我用Firefox请求内容,结果是压缩的。 Content-Encoding: gzip它说。 我已经尝试用ab指定所有Firefox指定的请求头,因为我看到它们被嗅探,但仍然得到它解压缩,并且Firefox得到压缩。 我正在运行一个我自己编译的nginx版本,但与Debian压缩backports 1.2.1版本是一样的,除了它有syslog补丁。 ApacheBench 2.3修订版655654.下面是nginx gzipconfiguration: gzip on; gzip_min_length 1000; gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript; gzip_disable "MSIE [1-6]\.(?!.*SV1)"; gzip_vary on; 文档types是text/html (没有在上面列出,但总是由nginx压缩;此外,我试着添加它,没有区别)。 它是dynamic的,从uwsgi后端收到。 来自ab嗅探请求标头: GET […] HTTP/1.0. Accept-Encoding: gzip, deflate. Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8. User-Agent: Mozilla/5.0 (X11; Linux i686 on x86_64; […]

htaccess filesMatch排除

我在我的htaccess中有以下指令 <filesMatch "\.(gif|jpe?g|png|js|css|swf|php|ico|txt|pdf|xml|html?)$"> FileETag None <ifModule mod_headers.c> Header unset ETag Header set Cache-Control "max-age=0, no-cache, no-store, must-revalidate" Header set Pragma "no-cache" Header set Expires "Wed, 11 Jan 1984 05:00:00 GMT" </ifModule> </filesMatch> 我在几个月前从Web的某个地方复制了这个正则expression式。 它应该将这些头添加到任何没有这些扩展的HTTP响应。 但它不工作,它将它们添加到任何响应。 我还需要创build另一个指令,将Header set Cache-Control "max-age=3600, public"到具有它们的文件的响应中。 任何人都可以帮我做适当的fileMatch正则expression式吗?

阿帕奇 – 强制为所有图像设置304状态

是否可以强制设置所有图像的HTTP 304状态? 我写了下面的代码在我的虚拟主机,但现在,而不是404/304状态我得到500 <filesMatch "\.(ico|gif|jpg|png|jpeg)$"> Header set 304 "HTTP/1.0 304 Not Modified" </filesMatch> 我有“Apache / 2.2.16(Debian)”版本。 谢谢你的帮助

如何configurationnginx使用URL的一部分作为头?

我正在尝试运行一个支持多个客户的服务器应用程序。 他们都应该使用自己的URL访问应用程序,例如http://localhost:8082/customer1/config ,但应用程序需要将客户特定部分作为请求标头。 该请求应该被redirect到http://localhost:9002/config 。 我可以做到这一点,如果我写每个客户的位置规则: server { listen 8082; server_name localhost; root /; location /customer1/ { proxy_set_header X-Forwarded-Host $host; proxy_set_header X-Forwarded-Server $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Host $host; proxy_cookie_path ~*^/.* /; proxy_set_header X-customer customer1; proxy_pass http://127.0.0.1:9002/; proxy_redirect off; } } 我怎样才能configurationnginx,所以它需要任何客户名称,并将其放入标题?

无法删除响应头中的服务器(Amazon AWS)

我无法从响应头中删除“服务器”标题。 我正在使用Amazon EC2。 我已经在Apacheconfiguration中添加了这个: 服务器签名关头未设置服务器请求头未设置服务器 它什么都不做。 我仍然可以在响应头文件中看到服务器头文件“Apache(Amazon)”。 任何线索?

可以使用HTTP头来判断页面是否通过代理?

有没有办法使HTTP服务器通过HTTP头告知连接是否包含代理服务器?

使用nginx可以在不改变浏览地址的情况下为页面404提供一个自定义的404页面

我如何强制nginx服务自定义的404页面,同时响应404头,而不改变浏览器的地址,以便用户可以轻松地重新键入? set $allowed 0; #(updated after comments) error_page 404 /404page.html; #(updated after first answer, forgot to mention) location = /authreq.html { if ($allowed = 0){ # return 307 $scheme://$host/404page.html ; #works but should be 404 # return 404 "shows this message"; #does not redirect when inserting url instead of message # rewrite ^ /404page.html break; […]

使用nginx进行Gzip压缩

在我的nginx.conf中有: gzip on; gzip_static on; gzip_buffers 16 8k; gzip_comp_level 9; gzip_http_version 1.0; gzip_min_length 1000; gzip_types text/plain text/css image/x-icon image/bmp image/png image/gif image/jpeg image/jpg application/json application/x-javascript text/javascript; gzip_vary on; gzip_proxied any; 所以,如果我在我的服务器上获取图片的标题: spiroo@glamdring:~$ curl -I http://static.mysite.com/g/pics/big_6e1855d844ebca560379139e75942f669655f.jpeg HTTP/1.1 200 OK Server: nginx Date: Thu, 04 Apr 2013 13:00:20 GMT Content-Type: image/jpeg Content-Length: 5336 Last-Modified: Mon, 25 Mar […]