Articles of http headers

与Nginx的auth_request_set和more_set_input_headers行为不一致

我正在尝试将auth_request模块与more_set_input_headers结合使用, 以便将我的用户自动login到Web应用程序中。 基本上,它是这样工作的: 用户有一些会话cookie来validation它们。 我有一个validationcookie的PHP脚本(auth.php),并返回他们正确的用户名作为响应头。 Nginx使用auth_request调用auth.php,并将用户名设置为一个variables。 Nginx然后调用Web应用程序,请求标头设置为正确的用户名。 networking应用程序读取标题,并将用户login。 这工作,但奇怪的不一致。 问题是,当用户访问/ app /上的web应用程序时,它可以工作,但是当应用程序在/app/index.php上访问时,它永远不会收到来自nginx的标题。 我创build了一个模拟configuration,重现错误。 Nginx的网站configuration: server { server_name www.example.com index index.php index.html; # — Internal auth location /auth { internal; root /var/www/sf; location /auth/auth.php { fastcgi_pass unix:/var/run/php5-fpm.sock; include includes/fastcgi_params; fastcgi_pass_request_body off; fastcgi_param CONTENT_LENGTH 0; } location /auth { deny all; } } location / { auth_request […]

Apacheconfigurationredirect只使用redirect,而不是重写

PS:这是最初发布在这里的问题的第二部分。 我想为特定的虚拟主机完全禁用HSTS标头 。 我有(每个build议 )在443容器中为这些虚拟主机中的每一个redirect。 它工作正常,但Apache 不build议使用RewriteRule,除非绝对必要。 是否有可能执行下面的redirect只使用redirect ,而不是重写? <VirtualHost xxxx:443> <IfModule mod_headers.c> Header unset Strict-Transport-Security Header always set Strict-Transport-Security "max-age=0;includeSubDomains" </IfModule> SuexecUserGroup "#520" "#520" ServerName dev.domain.com ServerAlias www.dev.domain.com ServerAlias subdomainjr2b.dev.domain.com ServerAlias www.subdomainjr2b.dev.domain.com ServerAlias subdomainblah.dev.domain.com ServerAlias www.subdomainblah.dev.domain.com RewriteEngine On RewriteRule ^(.*)$ http://%{HTTP_HOST}$1 [redirect=302] PS1:Domain.com有一个通配符证书,通配符只适用于sub.domain.com,而不是sub.sub.domain.com,因此需要禁用这些虚拟主机的hsts。 PS2:不要问我为什么我需要使用Header unset当我已经使用Header always set 。 它是在实现Header unset之前向客户端发送两个头文件,并且从我理解的不应该这样做 。

用NGINX文件清理caching,不更新WordPress

看来,清漆丢失或没有正确validationcaching。 当我尝试清除我的caching,我得到200 OKcaching成功清除,但我的网页不更新。 我只是简单地对我的footer.php进行HTML修改(使用WordPress),但是他们没有出现。 我检查了我的标题,他们如下所示: HTTP/1.1 200 OK Server: nginx/1.6.0 Content-Type: text/html Last-Modified: Wed, 23 Apr 2014 18:47:17 GMT ETag: "53580ab5-2" Content-Length: 2 Accept-Ranges: bytes Date: Fri, 10 Oct 2014 15:53:28 GMT X-Varnish: 21166333 Age: 0 Via: 1.1 varnish Connection: keep-alive X-Varnish标题中缺less“填充caching的请求的ID”。 所以我检查了标题,直接从我的VPS托pipe我的网站运行命令,它似乎工作正常: HTTP/1.1 200 OK Server: nginx/1.6.0 Content-Type: text/html; charset=UTF-8 Vary: Accept-Encoding X-Powered-By: PHP/5.4.33 […]

Nginx是否尊重上游服务器的maxage?

我看到了proxy_cache_valid指令,但是让我困惑。 在HTTP中,上游服务器不是用Cache-Control和maxage ? 如何获得Nginx的caching来使用maxage ?

在HAProxyredirect函数中注入头文件

我有HAProxy 1.5.8。 我有这个基本的301规则: frontend http_frontend bind *:80 mode http redirect location https://xxxx.com code 301 响应如下所示: HTTP/1.1 301 Moved Permanently Content-length: 0 Location: https://xxxx.com Connection: close 我需要在标题中添加一个date,就像普通的networking服务器一样。 respadd函数似乎不会影响redirect。 可能吗 ?

在Apache中解密一个头文件(HTTPD)

我被要求看看在处理请求期间是否有可能解密报头。 具体用例是通过从请求中删除另一个头(如果解密的数据不是“正确的”)来响应头的解密内容。 encryption头中的数据正被用于validation客户端的各个方面。 我可以看到如何使用带有未encryption头部值的mod_headers轻松完成这项工作,但是我还没有find头部,解密和使用结果值的任何内容。 我错过了什么,或者这是不可行的?

使用wget和相同的base-url的多个发布请求

wget有很好的select,可以让你从同一个位置下载多个文件 (我的意思是–base和–input-file组合) 这样做的好处是,如果可能的话wget尝试重用打开的套接字/连接。 我想知道是否有可能使用wget做多个POST请求。 (我可能最终写在python中,因为我不能在wget的文档中find这种用法) 即在input文件内我会有发布数据(json在我的情况): {"results":1} {"results":2} 并要求如下: wget –header "Content-Type: application/json" -i input.data http://example.com/api/data

浏览器发送max-age = 0,尽pipe标头在每个地方都被修改

我在灯[centos]网站有一个标题/caching问题。 configuration: [root@localhost httpd]# httpd -v Server version: Apache/2.2.23 (Unix) Server built: Nov 25 2012 15:03:00 [root@localhost httpd]# php -v PHP 5.5.22 (cli) (built: Feb 20 2015 04:04:46) Copyright (c) 1997-2015 The PHP Group Zend Engine v2.5.0, Copyright (c) 1998-2015 Zend Technologies with Zend OPcache v7.0.4-dev, Copyright (c) 1999-2015, by Zend Technologies php.ini中: session.cache_limiter = […]

CSS文件中的协议相关URL正在被覆盖

我有这个代码: <?php header('Content-Type: text/css; charset=utf-8'); ?> a.logo{background:url(//webzina.net/img/logo.png) no-repeat 100% 0} 本地(PHP版本5.3.5),我得到: a.logo{background:url(//webzina.net/img/logo.png) no-repeat 100% 0} 但是远程(PHP版本5.3.21),我得到: a.logo{background:url(http://webzina.net/img/logo.png) no-repeat 100% 0} 如果我对标题行进行评论,远程地获得与本地相同的内容。 最糟糕的是,远程我使用https,所以“http:”正在造成麻烦。 有人能告诉我哪个Apache / PHP设置搞乱协议相对的URL或为什么发生这种情况?

在.htaccess中为Https协议设置Access-Control-Allow-Origin

我有一个网站与http和https。 我在.htaccess中设置了为http运行的以下行。 标题集Access-Control-Allow-Origin“*” 但用https我得到这个错误。 请求的资源上没有“Access-Control-Allow-Origin”标题。 原因' https://dl.dropboxusercontent.com '因此不允许访问。 我试了下面没有运气。 标题集访问控制允许来源“*”env = HTTPS 任何方式设置HTTPS的访问控制 – 允许源头的.htaccess? 这是我完整的.htaccess <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteRule ^index\.php$ – [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] </IfModule> <IfModule mod_headers.c> Header always set Access-Control-Allow-Origin "*" </IfModule> 这是我的虚拟主机设置 <VirtualHost *:443> ServerAdmin admin@localhost DocumentRoot /var/www/html/domain ServerName domain.com SSLEngine […]