How to create a share variable between 2 server blocks

2021-04-12 Thread bouvierh
Hello! On a previous post I asked how I could get give a token to my Nginx server with having to put it in plain text in the config. One suggestion was to send to token in a request and use the javascript module to extract it. This is what I have been trying: load_module modules/ngx_http_js_module

Re: Rewrite with regex

2021-04-12 Thread Francis Daly
On Mon, Apr 12, 2021 at 03:01:12PM +0200, Artur wrote: > Le 12/04/2021 à 14:46, Francis Daly a écrit : Hi there, > > Does > > > > rewrite "^/([a-z][-a-z]{0,30}[a-z])$" ... > > > > do what you want in most cases? > > No, because it allows these cases I don't want : > > - a-b > - a---b---c

Re: Rewrite with regex

2021-04-12 Thread Artur
Le 12/04/2021 à 14:46, Francis Daly a écrit : > > Does > > rewrite "^/([a-z][-a-z]{0,30}[a-z])$" ... > > do what you want in most cases? No, because it allows these cases I don't want : - a-b - a---b---c---d By the way, the regex I sent before don't work correctly. It should be (still tes

Re: Rewrite with regex

2021-04-12 Thread Francis Daly
On Mon, Apr 12, 2021 at 02:21:15PM +0200, Artur wrote: > Le 12/04/2021 à 12:19, Francis Daly a écrit : > > On Mon, Apr 12, 2021 at 12:02:32PM +0200, Artur wrote: Hi there, > In fact it works as is. The only problem is that there is no simple way > to check the total string length. > But having se

Re: Rewrite with regex

2021-04-12 Thread Artur
Le 12/04/2021 à 12:19, Francis Daly a écrit : > On Mon, Apr 12, 2021 at 12:02:32PM +0200, Artur wrote: > > Hi there, > >> This seems to work : >> >> rewrite "^/((?:[a-zA-Z0-9]+(?:[-][a-zA-Z0-9])*)+)$" >> /index.php?short_name=$1 last; >> >> However, I suppose there is no way to check the size of $1

Re: Rewrite with regex

2021-04-12 Thread Francis Daly
On Mon, Apr 12, 2021 at 12:02:32PM +0200, Artur wrote: Hi there, > This seems to work : > > rewrite "^/((?:[a-zA-Z0-9]+(?:[-][a-zA-Z0-9])*)+)$" > /index.php?short_name=$1 last; > > However, I suppose there is no way to check the size of $1 here. So far, it looks like you want to allow either:

Re: Rewrite with regex

2021-04-12 Thread Artur
This seems to work : rewrite "^/((?:[a-zA-Z0-9]+(?:[-][a-zA-Z0-9])*)+)$" /index.php?short_name=$1 last; However, I suppose there is no way to check the size of $1 here. Le 12/04/2021 à 11:30, Artur a écrit : > Hello ! > > I have the following setup : > > location / { >  try_files $uri $uri/ @sho

Rewrite with regex

2021-04-12 Thread Artur
Hello ! I have the following setup : location / {  try_files $uri $uri/ @shortnames; } location @shortnames {  rewrite "^/([a-zA-Z0-9]{1,32})$" /index.php?short_name=$1 last;  return 404; } I filter the 'shortnames' URI to have a format similar to /dfg6df4g64 with minimum and maximum size, only