; > shows that nginx knows the $upstream_response_time at log time, as I
> get
> > this log:
> >
> > 127.0.0.1:8001 200 0.004
> >
> > Why does nginx substitute the request time and relevant response
> metadata
> > (like $upstream_status) at add_hea
me: -
>
> `cat app.log` shows that upstream was hit successfully, and `cat nginx.log`
> shows that nginx knows the $upstream_response_time at log time, as I get
> this log:
>
> 127.0.0.1:8001 200 0.004
>
> Why does nginx substitute the request time and relevant response metadata
log:
127.0.0.1:8001 200 0.004
Why does nginx substitute the request time and relevant response metadata
(like $upstream_status) at add_header time successfully, yet substitutes the
upstream response time with a dash?
My goal with returning $upstream_response_time in a header is so the client
ca
ems rather strange. Is it supposed to work this way?
If your location blocks contain any add_header directives then those
comming from server {} block are ignored (and you have to repeat them).
rr
___
nginx mailing list
nginx@nginx.org
http://mailman
The solution was to also add that header to the location{} block that I
use to manage the relevant static resources.
This seems rather strange. Is it supposed to work this way?
If your location blocks contain any add_header directives then those comming
from server {} block are ignored (and
Hi folks,
As a precaution against CORS, I
add_header Access-Control-Allow-Origin *;
outside any location{} block in my server{} definition.
I have recently had a problem where I deliver .css via a CDN, and that
CDN references font files also on the CDN, and this was triggering CORS,
so
st ~* www(.*)) {
> > set $host_without_www $1;
> > }
> > set_by_lua $expires_time 'return
> ngx.cookie_time(ngx.time()+2592000)';
> > add_header Set-Cookie
> > "value=1;domain=$host_without_www;path=/;expires=$expires_
> &
with expires and max-age cookie vars.
>
> if ($host ~* www(.*)) {
> set $host_without_www $1;
> }
> set_by_lua $expires_time 'return ngx.cookie_time(ngx.time()+2592000)';
> add_header Set-Cookie
> "value=1;domain=$host_without_www;path=/;expires=$expires_
>
92000)';
add_header Set-Cookie
"value=1;domain=$host_without_www;path=/;expires=$expires_time;Max-Age=2592000";
Posted at Nginx Forum:
https://forum.nginx.org/read.php?2,269438,269452#msg-269452
___
nginx mailing list
nginx@nginx.org
http://mailm
Actually no, ngx.time() is not expensive, it uses the cached value stored in
the request so it doesn't need to make a syscall.
> On Sep 9, 2016, at 06:33, itpp2012 wrote:
>
> Good, keep in mind that "ngx.time()" can be expensive, it would be advisable
> to use a global var to store time and upd
Can you provide a example also I seem to have a new issue with my code above
it is overwriting all my other set-cookie headers how can i have it set that
cookie but not overwrite / remove the others it seems to be a unwanted /
unexpected side effect.
Posted at Nginx Forum:
https://forum.nginx.org
Good, keep in mind that "ngx.time()" can be expensive, it would be advisable
to use a global var to store time and update this var once every hour.
Posted at Nginx Forum:
https://forum.nginx.org/read.php?2,269438,269444#msg-269444
___
nginx mailing lis
Solved it now i forgot in lua i declare vars from nginx different.
header_filter_by_lua '
ngx.header["Set-Cookie"] = "value=1; path=/; domain=" ..
ngx.var.host_without_www .. "; Expires=" ..
ngx.cookie_time(ngx.time()+2592000) -- +1 month 30 days
';
Posted at Nginx Forum:
https://forum.n
if ($host ~* www(.*)) {
set $host_without_www $1;
}
header_filter_by_lua '
ngx.header["Set-Cookie"] = "value=1; path=/; domain=$host_without_www;
Expires=" .. ngx.cookie_time(ngx.time()+2592000) -- +1 month 30 days
';
So i added this to my config but does not work for me :(
Posted at Ngin
In Lua it's as easy as:
https://github.com/openresty/lua-nginx-module/issues/19#issuecomment-19966018
Posted at Nginx Forum:
https://forum.nginx.org/read.php?2,269438,269439#msg-269439
___
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mai
So i read that IE8 and older browsers do not support "Max-Age" inside of
set-cookie headers. (but all browsers and modern support expires)
add_header Set-Cookie
"value=1;Domain=.networkflare.com;Path=/;Max-Age=2592000"; #+1 month 30
days
Apprently they support "expires
I sorted out this problem now
Here was my soloution.
if ($host ~* www(.*)) {
set $host_without_www $1;
}
add_header Set-Cookie
"logged_in=1;Domain=$host_without_www;Path=/;Max-Age=31536";
Posted at Nginx Forum:
https://forum.nginx.org/read.php?2,269189,269190#
So i am using Nginx to set a header now my PHP app sets this header too but
it sets the cookie with a domain of ".networkflare.com"
Nginx keeps setting it as "www.networkflare.com" i need to overwrite the
cookie not create a new one.
I have tried the following :
add_header S
Hello okamzol and thanks a lot for your answer!
Yes, it's exactly the same question, looks like I'll need to use include.
Best Regards
Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,260102,260104#msg-260104
___
nginx mailing list
nginx@ngin
Hi,
there is no chance to avoid the duplicates. I asked the same questions some
time ago.
For detailed answer on my question see
http://forum.nginx.org/read.php?2,256270,256279#msg-256279.
I think this will answer your question too.
Best Regards
Posted at Nginx Forum:
http://forum.nginx.org/re
Hello,
I'm using PHP with nginx 1.9.2 and it works great!
But there's something I don't understand with the add_header directive.
I use add_header in server and location block, but it seems only the one in
location is used.
If I remove the add_header in the location block, I g
On Wednesday 18 February 2015 17:57:13 Daniël Mostertman wrote:
[..]
> What am I doing wrong, if anything? And if I can avoid using "if" like
> that, I'd obviously prefer that.
>
You can avoid it by using the map directive and a variable
as the add_header v
Hi again,
And ugh, yet again realising what I did wrong right after hitting "send":
Daniël Mostertman schreef op 18-2-2015 om 17:57:
tl;dr: I want do have an add_header inside an if {}. nginx 1.7.10
won't let me.
Because I didn't put the if inside a location.
Ac
Hi!
I'm currently running 1.7.10 mainline straight from the nginx.org
repository.
We are hosting an application that needs to be accessible to Internet
Explorer users, in addition to all other *normal* browsers.
tl;dr: I want do have an add_header inside an if {}. nginx 1.7.10 won'
On Thu, Aug 14, 2014 at 10:16:43AM -0400, bodomic wrote:
Hi there,
> Actually, the second problem is described in this document too, I think I
> should re-read it every time I want to use IF.
"if" is fine.
It is only "if inside location" which needs care.
My general guideline is:
do "return .
Actually, the second problem is described in this document too, I think I
should re-read it every time I want to use IF.
In my example (before posting it here) I've dropped the second IF in the
same location without much thought.
That's why it worked for you. That's why it worked in a separate loca
Thanks for your reply, I've actually found the second traitor (i.e. why
second example won't work), will reply to Francis's post once more.
Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,252523,252574#msg-252574
___
nginx mailing list
nginx@n
Adding a few notes:
IF should only be used to return a state, ea. if ... 'error_page' and
nothing else because it breaks the chain of processing, when you really need
IF's, nested, setting values or otherwise use Lua.
For example: http://forum.nginx.org/read.php?2,251650,251777#msg-251777
The prob
Hi Francis,
Thanks for your thoughtful entry. It seems that it is a cloudy area of buggy
'if' behaviors :)
I've created empty host config with just 'location /' and 'if ...
add_header' and proxy_pass - and it works fine.
I'll have to retest this situation
On Wed, Aug 13, 2014 at 02:28:27AM -0400, bodomic wrote:
Hi there,
> Hi all, I've got strange behavior that I don't understand in two different
> configs. I'll post examples below, in both of them I use add_header two
> times and one of them is not working while sec
Hi all, I've got strange behavior that I don't understand in two different
configs. I'll post examples below, in both of them I use add_header two
times and one of them is not working while second does.
Example 1:
Request is: http://hostname/?region=XX
#This location adds
Hello!
On Thu, Dec 05, 2013 at 11:54:56AM +0100, Richard Stanway wrote:
> Hello,
> I'm trying to add some custom headers to a 403 response, but had a hard
> time doing so. Looking through the docs, it seems add_header "Adds the
> specified field to a response header prov
Hello,
I'm trying to add some custom headers to a 403 response, but had a hard
time doing so. Looking through the docs, it seems add_header "Adds the
specified field to a response header provided that the response code equals
200, 201, 204, 206, 301, 302, 303, 304, or 307. "
I was
Thanks. So using add_header in the location scope omits any earlier
add_header statements used in the parent scope. I am surprised that it
works like that, but it's definitely good to know.
On Mon, Sep 30, 2013 at 4:30 PM, Francis Daly wrote:
> On Mon, Sep 30, 2013 at 03:42:50PM +020
On Mon, Sep 30, 2013 at 03:42:50PM +0200, Thijs Koerselman wrote:
Hi there,
> From the add_header docs I understand that it works at location, http and
> server context. But when I use add_header at the server level I don't see
> the headers being added to the response.
> Am I
>From the add_header docs I understand that it works at location, http and
server context. But when I use add_header at the server level I don't see
the headers being added to the response.
For example my server config starts with:
server {
listen9088;
ser
Francis Daly Wrote:
---
Hello Francis, thanks for your response.
> In nginx, one request is handled in one location. So I expect that no
more
> than one set of add_header directives will apply. And as you only show
> regex location
On Thu, May 02, 2013 at 11:53:12AM -0400, flarik wrote:
Hi there,
> location ~ ^/assets/ {
> location ~* \.(ttf|ttc|otf|eot|woff)$ {
> Now the add_header stuff for webfonts is never set, and I do not understand
> why break has a part in this. When I remove break; it works,
>
Hello,
I'm trying to undestand the break; statement in combination with add_header
combo, on the wiki it says the following:
"Completes the current set of rules. Continue processing within the current
location block but do not process any more rewrite directives."
I read this as
39 matches
Mail list logo