0
votes
1answer
48 views

Update Cache-Control max-age when srcache returns response from cache

I have configured Nginx to use srcache (along with the redis and redis2 modules). Server-side caching works great. My application responds with the appropriate Expires and Cache-Control headers, and ...
0
votes
1answer
51 views

Inconsistent behavior with Nginx's auth_request_set and more_set_input_headers

I'm trying to use the auth_request module in conjunction with the more_set_input_headers to automatically login my users into web apps. Basically, it works like this: Users have some session cookie ...
0
votes
2answers
51 views

nginx - Change error_page based on proxy_pass response

Is it possible to change the fallback error_page based on the response of the upstream proxy? upstream serverA { server servera.com; } upstream serverB { server serverb.com; } location / { ...
0
votes
0answers
20 views

How to change http header using nginx

We have a problem that a backend system requires the parameters of the Content-Type http header to be in a certain order. For example (note the position of the type="text/xml"): Content-Type: ...
0
votes
1answer
73 views

How to configure nginx so it works with Express?

I'm trying to configure nginx so it proxy_pass requests to my node apps. Question on StackOverflow got many upvotes: http://stackoverflow.com/questions/5009324/node-js-nginx-and-now and I'm using ...
0
votes
2answers
124 views

NGINX is not forwarding a header value when using proxy_pass

I have the following setup and configured to send all /api requests to a different server: location /api { proxy_pass https://myapp.herokuapp.com; rewrite ...
0
votes
1answer
136 views

nginx proxy_pass receive content/status headers when http 4xx

Was having some trouble as chronicled here - http://stackoverflow.com/questions/22570550/play-2-2-1-simpleresult-4xx-response-body-possible-via-cors-xhr But I didn't focus on nginx since the 200 OK ...
0
votes
1answer
56 views

Nginx using mysql result as variable to be used in headers more module

Without going into too much detail we have a requirement for the following: a) Query a simple single column, single row result from mysql. b) Use this variable as part of a more headers module, ...
1
vote
1answer
151 views

Nginx: How to set expiration for 404 responses?

My nginx server acts as a proxy for another server, which sometimes returns 404s. I want the 404 responses to be cacheable, just like 200 responses. However, I cannot use expires, because the ...
0
votes
1answer
378 views

Nginx $http_x_forwarded_for not always being set

I've noticed in our access logs that sometimes, the $http_x_forwarded_for variable has not been set, and instead, the correct IP is the one set to $remote_addr. Is it possible to set ...
0
votes
1answer
242 views

Cache header for dynamically created url

I have a PHP script that generates a thumbnail based on an existing path (more info). The basic idea is this: Given the document root /web/, an image lives in /web/images/foo.jpg. When a predefined ...
2
votes
0answers
37 views

Strange faulty 16000d response timing in gdevtools for specific XHR

We have some XHR on our website, that is reported in Google developer tools' network timeline as Receiving for 16035.5 days. There actually is a response, and for sure it does not take as long as ...
1
vote
2answers
260 views

Why is SPDY breaking 'Vary: Accept-Encoding' in Nginx 1.4.3?

I've compiled Nginx 1.4.3 from source with the SPDY module. However when SPDY is enabled, it seems to break my 'Vary: Accept-Encoding' header. My Nginx Configuration: ./configure ...
2
votes
1answer
268 views

Remove “X-Page-Speed” version from headers in ngx_pagespeed

I have compiled ngx_pagespeed, but forgot to remove the version number. Is there any way to overwrite/delete/hide them? Apache has feature to 'unset' them, but I couldn't find anything similar for ...
3
votes
1answer
1k views

Disabling 206 partial content responses on nginx

I have an HTML5 web app that uses a video tag. Depending on the user actions, different parts of the video will be played in response. This video does not exceed 5MB. I need this video to be entirely ...
0
votes
1answer
150 views

Sending two Content-Security-Policy headers

I current have an nginx server that is sending the Content-Security-Policy header, however I've read that apparently IE only supports "X-Content-Security-Policy". Would it be a good idea to send both ...
0
votes
1answer
459 views

nginx expires directive without Cache Control header

Is it possible to use the expires directive in nginx to display the "Expires" header alone without the Cache-control ? Also I've seen some websites whose max-age value decrements over time. Example ...
0
votes
2answers
146 views

Can't get nginx to reply to ab with compressed content

ab -n 1 -H 'Accept-Encoding: gzip, deflate' http://mywebsite.com/ This always returns the uncompressed content (I can see that both from its size and because I'm sniffing the traffic with ngrep). ...
1
vote
1answer
720 views

nginx and HTTP Referer

I'm using nginx together with php5-fpm and with the following fastcgi_params file: fastcgi_param CONTENT_LENGTH $content_length; fastcgi_param CONTENT_TYPE $content_type; ...
0
votes
0answers
642 views

Why does nginx not send the Content-Length header when the request is HEAD?

I am using CURL to test HEAD requests to my nginx server. The file being served is a simple PHP file. If I use GET: $ curl -XGET http://test.com/phpinfo.php -I HTTP/1.1 200 OK Date: Tue, 09 Apr 2013 ...
1
vote
0answers
86 views

nginx: how to serve files in gzip format when client accepts “Accept-Encoding: gzip” and inflated otherwise?

I have a folder full of .gz files and would like to serve them transparently inflated if requested by a client that does not send Accept-Encoding: gzip in the request and as-is (gzip'd) otherwise. I ...
0
votes
1answer
74 views

How respect acept: text/plain with nginx? [duplicate]

In http header there is a field named accept, so client can specify prefered format. How can I configure nginx to return markdown page in case of plain text request and processed via some markdown ...
0
votes
1answer
186 views

nginx ssl proxy for one hostname only

I want nginx to serve as a ssl proxy but for host: "ssl.example.com" at the same time I want nginx to serve "nginx is ok" website for host: "ssl-check.example.com" (this is just example, please don't ...
0
votes
1answer
742 views

Set Access-Control-Allow-Origin in nginx using wildcard domain

With nginx can I specify Access-Control-Allow-Origin using a wildcard like *.mydomain.com? Would it look like: add_header Access-Control-Allow-Origin *.mydomain.com; Thanks.
1
vote
2answers
556 views

nginx redirection cycle with X-Accel-Redirect

Trying to get nginx to work with the X-Accel-Redirect header. I'm getting this error: *24 rewrite or internal redirection cycle while internally redirecting to "/app/index.php", client: 127.0.0.1, ...
-1
votes
1answer
350 views

Lowercase headers [closed]

One thing I've noticed about CloudFlare and Google's web servers are that they both use lowercase response headers. Is this just for looks, or does it actually provide a performance increase? I'm ...
2
votes
2answers
476 views

nginx conditional Accept header

Some mobile devices send the following incorrect requests to our servers : GET / HTTP/1.0 Accept: User-Agent : xxx The empty Accept header causes our Ruby on Rails server to throw back a 500 error. ...
0
votes
1answer
344 views

nginx rule to capture header and append value as query string

I have an interesting problem I need to solve in nginx: one of the sites I'm building receives inbound traffic on port 80 (and only port 80) which may have a certain header set in the request. If this ...
2
votes
1answer
995 views

server_tokens off but still publishing them

I added server_tokens off; to http{} section of /etc/nginx/nginx.conf file and restarted nginx with service nginx restart command. but server still publishing the server tokens when responsing ...
2
votes
1answer
2k views

Nginix proxy caching - how to check if it is working?

I have set up my nginx.conf file to use proxy caching from tutorials I have found online. However, I am trying to figure out how to check if it is actually working. I've read somewhere that adding ...
0
votes
1answer
331 views

Make nginx avoid cache if response contains Vary Accept-Language

The cache module of nginx version 1.1.19 does not take the Vary header into account. This means that nginx will serve the same request even if the content of one of the fields specified in the Vary ...
4
votes
2answers
772 views

How to set cache to never expire and minimize requests in Nginx?

I have a cache invalidation system in place, so I need to set the cache for css|js to never expire. I tried this location ~* \.(js|css)$ { # |png|jpg|jpeg|gif|ico expires max; #log_not_found ...
5
votes
1answer
741 views

add_header directives in location overwriting add_header directives in server

Using nginx 1.2.1 I am able to add multiple headers using add_header as follows: server { listen 80; server_name localhost; root /var/www; add_header Name1 Value1; <=== ...
2
votes
1answer
390 views

How to remove “Client-Peer” (etc) header in nginx with php-fastcgi

My setup: OS: Ubuntu 11.04 HTTP Server: nginx 1.2.1 compiled with the HttpHeadersMore module processing PHP via php-fastcgi (other irrelevant software - ruby, python, etc) My problem: I'm ...
0
votes
1answer
726 views

NGINX + GZIP - Altering Vary header to include User-Agent

Currently, when nginx is set to gzip outbound content as requested by the client, the "gzip_vary on" setting will set the following header: Vary: Accept-Encoding We would like to modify this to ...
6
votes
1answer
2k views

Nginx : strip header on HTTP, add header on HTTPS

I'm configuring an Nginx server so as to serve as a reverse proxy to serve a Django app (run on Gunicorn). My problem is that I want my site secured with HTTPS, and so I want my Django app to be able ...
1
vote
1answer
395 views

Sending HTTP headers by webserver or PHP?

It is equally possible to send HTTP headers by webserver or script. I use PHP on Nginx. Is there any different to send HTTP headers (such as Cache-Control) by nginx or PHP? Is it faster to send ...
0
votes
1answer
1k views

NGINX MIME TYPE

I have my nginx conf file so that when ever a mobile device visits my site the url gets rewritten to m.mysite.com I did it by adding the following set $mobile_rewrite do_not_perform; if ...
0
votes
1answer
372 views

Is html or php header needed for gzip?

I use gzip module of nginx to compress documents. When gzip is enabled nginx will automatically send content-ending of gzip with HTTP headers, right? Without adding any PHP header header() or HTML ...
2
votes
2answers
638 views

In Nginx, block user based on X header value

I have 6 Nginx servers behind load balancer. Of course, if I just try to "deny" based on IP address it does not work as the app servers just see the load balancer IP. However, I learned about the ...
1
vote
0answers
1k views

Leverage browser caching on nginx

I am using nginx for my webserver. I am trying to set an expiry date or a maximum age in the HTTP headers for static resources but it doesnt work. This is what i am using; location ~* ...
1
vote
0answers
660 views

nginx + @font-face + Firefox / IE9

Just transferred my site from a shared hosting to Linode's VPS, and I'm also completely new to nginx, so please don't be harsh if I missed something evident ^^ I've got my WordPress site running ...
8
votes
3answers
7k views

nginx real_ip_header and X-Forwarded-For seems wrong

The wikipedia description of the HTTP header X-Forwarded-For is: X-Forwarded-For: client1, proxy1, proxy2, ... The nginx documentation for the directive real_ip_header reads, in part: This ...
6
votes
3answers
2k views

nginx passing back custom header

I have the following example location / { proxy_read_timeout 2000; proxy_next_upstream error; proxy_set_header X-Real-IP ...
3
votes
3answers
1k views

Is it possible to route requests to different applications via Content-Type?

I'm designing a JSON API, and I'd like to version the API using content negotiation of some kind. I'm currently planning on using Vendor MIME Types to do this. While I can definitely do this at the ...
3
votes
1answer
4k views

How do I alter the Last-Modified header on NGNIX?

My server returns the following headers: Cache-Control:no-cache Connection:keep-alive Date:Thu, 07 Jul 2011 10:41:57 GMT Expires:Thu, 01 Jan 1970 00:00:01 GMT Last-Modified:Thu, 07 Jul 2011 08:06:32 ...
0
votes
2answers
164 views

How to set multiple HTTP headers

Likewise in Apache is there a way you can setup multiple headers in nginx? location ~.*\.(css|html|js)$ { expires 30d; I currently have that set, but I was thinking to make js and css ...
1
vote
2answers
1k views

nginx status code 200 and 304

I'm using nginx + passenger. I'm trying to understand the nginx response 200 and 304. What does this both means? Sometimes, it responses back in 304 and others only 200. Reading the YUI blog, it seems ...
0
votes
2answers
553 views

Masking / Pointing subdomain to different server and keeping same url in address

Originally posted on Stack Overflow. This may be a question for Server Exchange but I am starting to feel pretty cozy here and I feel like someone here will definitely know the answer. We are ...
2
votes
4answers
3k views

How to check for the existence of a response header in Nginx rules?

Setting up the rewriting rules for the request proved to be quite easy in Nginx. For the response, not so much (at least, not for me). I want to strip the Content-Type header from the response if the ...