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

Re: rewrite with regex to use proxy_pass

2017-06-30 Thread Wandenberg Peixoto
If I'm not wrong the rewrite is applied only for the path, not for querystring. To parse the arguments using a regex use a map with $args as input or use the $arg_ARGNAME to the rewrite. On Jun 30, 2017 20:49, "Alexandre" wrote: > Do you have solutions for my problem ? > > Thank you very much. >

Re: rewrite with regex to use proxy_pass

2017-06-30 Thread Alexandre
Do you have solutions for my problem ? Thank you very much. On Fri, 30 Jun 2017 08:18:50 +0200 Alexandre wrote: > Hello, > > I have a question, I wish I could parser a url and retrieve fields to > inject them to another server. > > However, I can not. Here is my test: > > URL : > http://myw

rewrite with regex to use proxy_pass

2017-06-29 Thread Alexandre
Hello, I have a question, I wish I could parser a url and retrieve fields to inject them to another server. However, I can not. Here is my test: URL : http://mywebsite.net/folder1/folder2/hit.php?s=1&s2=&p=home::index&x2=[box]&apvr=[5.0]&idclient=&na=&ref= location ~ ^/folder1/folder2/ {