Michael McCallister | 10 Feb 00:37
Favicon
Gravatar

filter out headers for fastcgi cache

Greetings,

I would like to propose that an additional feature for nginx be 
considered related to fastcgi caching: the ability to specify headers 
that will not be stored in cache, but will be sent to the client when 
the cached version is created (sent to the client responsible for 
creating the cached copy).  If some solution already exists providing 
this functionality, my apologies, I was not able to track one down - 
currently assuming one does not exist.

Here is one scenario where such an option would be useful (I am sure 
there are others):

A typical scenario where fastcgi caching can be employed for performance 
benefits is when the default version of a page is loaded.  By "default", 
I mean the client has no prior session data which might result in unique 
session specific request elements.  In the case of PHP, the presence of 
session data is typically determined by checking for the presence of a 
"PHPSESSID" cookie.  So if this cookie does not exist, then it can be 
assumed there is no session - an optimal time to create a cached version 
of the page in many scenarios.  However, many PHP apps/sites/etc. also 
create a session in the event one does not exist (a behavior I assume is 
not specific to PHP) - meaning the the response typically contains a 
Set-Cookie: PHPSESSID.... header.  Nginx's default behavior is not to 
cache any page with a Set-Cookie header, and that makes sense as a 
default - but lets assume for this example that fastcgi_ignore_headers 
Set-Cookie; is in effect and the cached version of the default version 
of the page gets created.  The problem here is that the cached version 
created also has the Set-Cookie header cached as well - which causes 
problems for obvious reasons (hands out the same session ID/cookie for 
(Continue reading)

jwilson | 9 Feb 23:43
Picon

Adding "Link" Header

To avoid SEO issues on my subdomains, I need to add a "Link" header to
support Google's canonical header.  The format is as follows (from
http://googlewebmastercentral.blogspot.com/2011/06/supporting-relcanonical-http-headers.html):

Link: <http://www.example.com/white-paper.html>; rel="canonical"

So, the add_header command would need to reference $uri, but it also
needs a semi-colon and double quotes.  How can I add this header to my
config?

Posted at Nginx Forum: http://forum.nginx.org/read.php?2,222185,222185#msg-222185
Bai Shen | 9 Feb 18:49
Picon

Config file order

I know the server order in the config file makes a difference.  Does the order of the statements inside the location tags make a difference?

Do I need to set the headers before doing a proxy_pass or does it matter?

Thanks.

_______________________________________________
nginx mailing list
nginx@...
http://mailman.nginx.org/mailman/listinfo/nginx
Bai Shen | 9 Feb 18:42
Picon

Binding nginx to a single interface

I have two nics on my server.  I have nginx set to listen on one of them using "listen 10.1.2.3 80"  However, it keeps listening on the other ip as well.  So i'm unable to start anything else on port 80 on that interface.

Any ideas what could be wrong?  Everything I'm finding says that the listen command is all I needed to do.

_______________________________________________
nginx mailing list
nginx@...
http://mailman.nginx.org/mailman/listinfo/nginx
keef | 9 Feb 12:55
Picon

Unable log out of some applications.

We have a at least a two web applications (Zenoss & Sharepoint) behind
nginx that we are unable to log out off!

We have many other websites (>200) also behind nginx that don't have
this issue. Before posting the configuration I was wondering if anyone
could take a guess at what the problem might be ?

Thanks
Keith

Posted at Nginx Forum: http://forum.nginx.org/read.php?2,222147,222147#msg-222147
Maxim Dounin | 9 Feb 09:37
Picon

Re: Perl interaction with HTTP Proxy:

Hello!

On Thu, Feb 09, 2012 at 02:30:36AM -0600, Engin Akyol wrote:

> Hey guys, I'm trying to write a couple of perl modules for my nginx
> server that is acting as an HTTP Proxy.
> 
> What I'd like to do is use Perl to perform some (quick) checks and
> then return an error code, but I'm noticing that if I execute any perl
> code before the config block that engages the http_proxy, the perl
> error code is ignored.  If I execute the perl block after the
> http_proxy, then the connection isn't proxy passed at all.  Is this a
> config issue on my part or is this normal behavior with regards to
> perl.  If it's normal behavior, how can I use perl modules to perform
> checks with http_proxy features enabled?

Both perl and proxy set exclusive location handlers, and they 
can't be used together in the same location.

If you need to check requests with perl and then proxy_pass 
somewhere, you have to use $r->internal_redirect(uri) in perl to 
pass processing to another location with proxy_pass configured.

Maxim Dounin
Engin Akyol | 9 Feb 09:30
Picon
Gravatar

Perl interaction with HTTP Proxy:

Hey guys, I'm trying to write a couple of perl modules for my nginx
server that is acting as an HTTP Proxy.

What I'd like to do is use Perl to perform some (quick) checks and
then return an error code, but I'm noticing that if I execute any perl
code before the config block that engages the http_proxy, the perl
error code is ignored.  If I execute the perl block after the
http_proxy, then the connection isn't proxy passed at all.  Is this a
config issue on my part or is this normal behavior with regards to
perl.  If it's normal behavior, how can I use perl modules to perform
checks with http_proxy features enabled?

/Engin
Quintin Par | 9 Feb 08:04
Picon
Gravatar

Old thread: Cache for non-cookie users and fresh for cookie users

Picking up an old thread for caching

http://nginx.2469901.n2.nabble.com/Help-cache-or-not-by-cookie-td3124462.html

Igor talks about caching by

“No, currently the single way is:

1) add the cookie in proxy_cache_key

   proxy_cache_key  "http://cacheserver$request_uri $cookie_name";

2) add "X-Accel-Expires: 0" in response with the cookie.”

But from my understanding of “X-Accel-Expires” it expires the cache in the cache repository as given below

“Sets when to expire the file in the internal Nginx cache, if one is used.”

Does this not mean that when I set cookie and pass “X-Accel-Expires: 0” it expires the cache for the non logged in user too, for that cache key? A new cache entry will then have to be created, right?

Should I go with “Cache-Control: max-age=0” approach?

 

_______________________________________________
nginx mailing list
nginx@...
http://mailman.nginx.org/mailman/listinfo/nginx
zealot83 | 9 Feb 02:06
Picon

504 SSL_do_handshake() failed

A similar problem to below case occurred in mine.
http://forum.nginx.org/read.php?2,144108,222098#msg-222098

Following is the ssl server configuration.
At first I used AJP.
But after I could not find a corresponding directive to
proxy_ssl_session_reuse, I changed to proxy.

upstream loadbalancer {
server 127.0.0.1:8080;

keepalive 100;
}

server {
listen 443 default ssl;
ssl on;

......

location / {
#access_log off;
#ajp_pass loadbalancer;
proxy_pass http://loadbalancer;
proxy_ssl_session_reuse off;
}
}

Here's the error log:
2012/02/08 15:03:49 [info] 13273#0: *1 SSL_do_handshake() failed (SSL:
error:14094416:SSL routines:SSL3_READ_BYTES:sslv3 alert certificate
unknown) while SSL handshaking,

Any help would be greatly appreciated!
Thanks in advance!

Posted at Nginx Forum: http://forum.nginx.org/read.php?2,222128,222128#msg-222128
Max | 9 Feb 01:58
Picon
Gravatar

Re: Unique server for all domains or a server per domain?


09 февраля 2012, 04:03 от "B.R." <reallfqq-nginx <at> yahoo.fr>:

> I am currently using a unique server conf for all my domains.
> When I wanna restrain certain activity to certain domains (subdirectories,
> URL rewriting, etc.) I do not have other choice than using 'if' on the
> $host variable leading to some complications due to the unreliable nature
> of the 'if' clause.
> The directory from which the content is served is determined by the
> hostname.
> 
> On the other side, is using several servers to listen on several domains
> the best solution?

Using separate per-domain server configuration blocks is both
more efficient and easier to configure and maintain. Using a
single server configuration block for many domains requires
many "if" blocks, which are computationally intensive to
evaluate, so you should avoid using them whenever possible.
Most of the time you'll be using "if" blocks for rewrites,
so it's better to just use separate server configuration
blocks with direct rewrites.

Max
_______________________________________________
nginx mailing list
nginx <at> nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
B.R. | 9 Feb 01:02
Picon
Favicon

Unique server for all domains or a server per domain?

Hello,

I am currently using a unique server conf for all my domains.
When I wanna restrain certain activity to certain domains (subdirectories, URL rewriting, etc.) I do not have other choice than using 'if' on the $host variable leading to some complications due to the unreliable nature of the 'if' clause.
The directory from which the content is served is determined by the hostname.

On the other side, is using several servers to listen on several domains the best solution?
Since NGinx is event-based and not client-based maybe that's not a problem anymore... But not so long ago I was stuck with Apache. I still need to get used to that (great!) change.
---
B. R.
_______________________________________________
nginx mailing list
nginx@...
http://mailman.nginx.org/mailman/listinfo/nginx

Gmane