Location Directive Not Working - Help Please

2024-04-15 Thread duluxoz
Hi All, Quick Q: Why does the following config not work ie NginX is returning a 404 when I attempt to access a php file/page from the "/common/" location? Obviously I'm misunderstanding something about how location directives work  :-) ~~~ location /common/ {   root /www;  

Re: location {} access_log off -> no such file or directory

2024-02-28 Thread J Carter
Hello, On Mon, 26 Feb 2024 09:55:10 +0100 "Roberto D. Maggi" wrote: > Hi you all, > > I'm trying to improve the reverse proxy's virtual hosts' configuration > files of my company, > > but I'm facing an issue that I can't understand: >

location {} access_log off -> no such file or directory

2024-02-26 Thread Roberto D. Maggi
Hi you all, I'm trying to improve the reverse proxy's virtual hosts' configuration files of my company, but I'm facing an issue that I can't understand: In the "location / " block I inserted these lines location ~* ^.+\.(eot|otf|woff|woff2|ttf|rss|atom

Re: location ~* \.(...) access_log off; prevents access to files instead of logs

2023-11-14 Thread Maxim Dounin
imply work and the second blocks > > --> here I'm trying to add this header only to cgi|shtml|phtml|php > extensions > > location ~* \.(?:cgi|shtml|phtml|php)$ { >   add_header Cache-Control "public"; >   client_max_body_size 0; >   chunked_transfe

location ~* \.(...) access_log off; prevents access to files instead of logs

2023-11-14 Thread Roberto D. Maggi
Hi you all, I'm having a problem with these two stanzas, in writing down a virtual host and can't figure out what's wrong with them. They look correct but the first doesn't simply work and the second blocks --> here I'm trying to add this header only to cgi|shtml|phtm

restricting the http method for all location and enable the same for specific location

2023-07-24 Thread Rathore, Rajendra
Hi Team, We are looking for restricting the http method for all location and enable the same for specific location, I found the way in Apache http server, I am unable to find the same in NGINX, can you please guide me here, how to achieve it. Code snippet works in Apache Http server

Re: Separate location for files served by php-fpm

2023-05-24 Thread Francis Daly
On Thu, May 18, 2023 at 09:14:42PM -0700, Palvelin Postmaster via nginx wrote: Hi there, > My goal is to serve only requests which include URI /files/hash/* > using a separate location block. Everything else should be served by > the default location block I included in my previou

Re: How to create same location to point different proxy server

2023-05-23 Thread Sergey A. Osokin
e configuration file how to do this. Below is the sample > configuration for the server ignapp. Can you please help me how to > configure the below settings for another upstream server. Below is the > config setting for ignapp same way I need to do it for creating location ~ > /da

Re: Separate location for files served by php-fpm

2023-05-18 Thread Palvelin Postmaster via nginx
with nginx. >>> >>> My PHP app serves files which have hashed filenames and no filename >>> extension from a specific subdirectory url, e.g >>> /files/hash/31b4ba4a0dc6536201c25e92fe464f85 >>> >>> I would like to be able to set, for exampl

Re: Separate location for files served by php-fpm

2023-05-15 Thread Francis Daly
o filename > > extension from a specific subdirectory url, e.g > > /files/hash/31b4ba4a0dc6536201c25e92fe464f85 > > > > I would like to be able to set, for example, a separate ’expires’ value to > > these files with nginx (using a separate location block?). Is that

Re: Separate location for files served by php-fpm

2023-05-15 Thread Palvelin Postmaster via nginx
ory url, e.g > /files/hash/31b4ba4a0dc6536201c25e92fe464f85 > > I would like to be able to set, for example, a separate ’expires’ value to > these files with nginx (using a separate location block?). Is that achiavable? > > server { > listen 443 ssl http2; > se

Separate location for files served by php-fpm

2023-05-08 Thread Palvelin Postmaster via nginx
with nginx (using a separate location block?). Is that achiavable? server { listen 443 ssl http2; server_name my.site.com; root /var/www/vhosts/my.site.com/site/; set $ngspage /index.php?ngspage=$uri$is_args&$args; # PHP file processing configura

Re: Private location does not work

2023-02-20 Thread Saint Michael
rization. > > Good luck > -Payam > > On Mon, Feb 20, 2023 at 4:35 AM Francis Daly wrote: > >> On Sun, Feb 19, 2023 at 09:33:46AM -0500, Saint Michael wrote: >> >> Hi there, >> >> > it does not work: >> > 404 Not Found >> >> I

Re: Private location does not work

2023-02-20 Thread Payam Chychi
; > Hi there, > > > it does not work: > > 404 Not Found > > It appears that you are not asking "how do I ensure that a location{} > can only be used for internal redirects/requests". > > > in the public location, /carrier_00163e1bb23c, I hav

Re: Private location does not work

2023-02-20 Thread Francis Daly
On Sun, Feb 19, 2023 at 09:33:46AM -0500, Saint Michael wrote: Hi there, > it does not work: > 404 Not Found It appears that you are not asking "how do I ensure that a location{} can only be used for internal redirects/requests". > in the public location, /carrier_0

Re: Private location does not work

2023-02-19 Thread Saint Michael
Thanks for your patience. I publish a report, which takes 1 minute to complete. So I send the users to a spinner, which has an Iframe inside. While the spinner spins, the iframe runs the report from the /internal location. Once the report is ready, the spinner hides the div and replaces the

Re: Private location does not work

2023-02-19 Thread Payam Chychi
ands of times before. >>>> >>>> Your 404 is expected error code when you are accessing the website from >>>> external. >>>> >>>> Also, read >>>> https://nginx.org/en/docs/http/ngx_http_access_modul

Re: Private location does not work

2023-02-19 Thread Saint Michael
;> >>> Your 404 is expected error code when you are accessing the website from >>> external. >>> >>> Also, read >>> https://nginx.org/en/docs/http/ngx_http_access_module.html >>> >>> >>> >>> >>

Re: Private location does not work

2023-02-19 Thread Payam Chychi
code when you are accessing the website from >> external. >> >> Also, read >> https://nginx.org/en/docs/http/ngx_http_access_module.html >> >> >> >> >> On Sun, Feb 19, 2023 at 6:34 AM Saint Michael wrote: >> >>> Dear Francis >&g

Re: Private location does not work

2023-02-19 Thread Saint Michael
> external. > > Also, read > https://nginx.org/en/docs/http/ngx_http_access_module.html > > > > > On Sun, Feb 19, 2023 at 6:34 AM Saint Michael wrote: > >> Dear Francis >> it does not work: >> 404 Not Found >> >> this is my cod

Re: Private location does not work

2023-02-19 Thread Payam Chychi
/docs/http/ngx_http_access_module.html On Sun, Feb 19, 2023 at 6:34 AM Saint Michael wrote: > Dear Francis > it does not work: > 404 Not Found > > this is my code > location /asr { > default_type 'text/html; charset=UTF-8'; > internal; > >

Re: Private location does not work

2023-02-19 Thread Saint Michael
Dear Francis it does not work: 404 Not Found this is my code location /asr { default_type 'text/html; charset=UTF-8'; internal; } location /carrier_00163e1bb23c { default_type 'text/html; charset=UTF-8'; .... } in the public location, /carrier_00163e1bb23

Re: Private location does not work

2023-02-19 Thread Francis Daly
On Sun, Feb 19, 2023 at 01:52:12AM -0500, Saint Michael wrote: Hi there, > it fails with forbidden. But I am using only from another location inside > the same server. > > How do I protect internal service locations and at the same time use them? If you are asking "how d

Private location does not work

2023-02-18 Thread Saint Michael
> > I have two locations /x /yy the public one is /y, nobody is supposed to access /x from the Internet. Inside /, I call /x, but if I do this: location /asr { default_type 'text/html; charset=UTF-8'; allow 127.0.0.1; deny all; it fails with for

Re: Allow/Deny rules in Location block

2023-01-27 Thread sandeep dubey
single C subnet 10.48.0.1-254). > > Then again, your whole configuration would be simpler with just a single > location block (since it doesn't seem you have an application which uses > /auth without a trailing slash): > > location /auth/ { > allow 172.20.0.

RE: Allow/Deny rules in Location block

2023-01-25 Thread Reinis Rozitis
sure how to organise or set the right sequence here. Just from the log it seems correct - you have a rule to allow 10.48.0.0/24; but the ip 10.48.11.9 doesn't go within that subnet (/24 subnet mask is just a single C subnet 10.48.0.1-254). Then again, your whole configuration would be simpler

Re: Allow/Deny rules in Location block

2023-01-24 Thread sandeep dubey
Thanks Daniel for the reply. I have attached my config file for reference in a previous reply. On Wed, Jan 25, 2023 at 10:58 AM nanaya wrote: > Just adding, if it's `location /auth {}`, it'll also match /autha, /authb, > /authsomething/something, not just limited to /auth/*. &g

Re: Allow/Deny rules in Location block

2023-01-24 Thread sandeep dubey
/admin, /auth/admin/ > and few more which have the same rules. I am trying to restrict access to > /auth and /auth/admin which are sensitive for public access. Do you think > removing "=" can help in this case? > > > '=' in location definition means that nginx w

Re: Allow/Deny rules in Location block

2023-01-24 Thread nanaya
Just adding, if it's `location /auth {}`, it'll also match /autha, /authb, /authsomething/something, not just limited to /auth/*. On Wed, Jan 25, 2023, at 01:56, Reinis Rozitis wrote: >> There are other locations like /auth, /auth/, /auth/admin, /auth/admin/ and >> few mo

RE: Allow/Deny rules in Location block

2023-01-24 Thread Reinis Rozitis
> There are other locations like /auth, /auth/, /auth/admin, /auth/admin/ and > few more which have the same rules. I am trying to restrict access to /auth > and /auth/admin which are sensitive for public access. Do you think removing > "=" can help in this case? 

Re: Allow/Deny rules in Location block

2023-01-23 Thread sandeep dubey
n Mon, Jan 23, 2023 at 6:08 PM Reinis Rozitis wrote: > > I am trying to restrict some Location block in my Nginx configuration to > > specific IPs. Below are the changes I made - > > > >location = /auth { > > } > > > > Here, the deny

Re: Allow/Deny rules in Location block

2023-01-23 Thread sandeep dubey
> > Hope this helps. > > Ian > > On 23/01/2023 16:34, sandeep dubey wrote: > > Hello, > > > > I am trying to restrict some Location block in my Nginx configuration to > > specific IPs. Below are the changes I made - >

RE: Allow/Deny rules in Location block

2023-01-23 Thread Reinis Rozitis
> I am trying to restrict some Location block in my Nginx configuration to > specific IPs. Below are the changes I made - > >location = /auth { > } > > Here, the deny rule is not working. Users are still able to access the > page publicly. Am I mis

Re: Allow/Deny rules in Location block

2023-01-23 Thread Ian Hobson
think you need 1.2.3.4/24 which allows all of the format 1.2.3.* Hope this helps. Ian On 23/01/2023 16:34, sandeep dubey wrote: Hello, I am trying to restrict some Location block in my Nginx configuration to specific IPs. Below are the changes I made - Version: nginx:1.21.0 location

Allow/Deny rules in Location block

2023-01-23 Thread sandeep dubey
Hello, I am trying to restrict some Location block in my Nginx configuration to specific IPs. Below are the changes I made - Version: nginx:1.21.0 location / { > proxy_pass http://127.0.0.1:8080; > } > location = /auth { > proxy_pass http://12

Re: If statement with $limit_req_status under location block with proxy_pass not working

2022-08-09 Thread acidiclight
This worked great. Thank you for your help! Posted at Nginx Forum: https://forum.nginx.org/read.php?2,294407,294929#msg-294929 ___ nginx mailing list -- nginx@nginx.org To unsubscribe send an email to nginx-le...@nginx.org

Re: location regex?

2022-08-04 Thread Francis Daly
g there would be of the form location ~ announce {} but only in a place where that location will actually have a chance to be matched -- so before any other ~regex location that might match the same request; and any =exact location, or ^~prefix location that is the longest-prefix match, will mean that

location regex?

2022-08-03 Thread Jay Haines
I am trying to weed out requests for any uri that contains the string, "announce" (no quotes). That would include * /announce * /announce/ * /announce.php each with or without query strings. I have the following location blocks in my server context:    location ~

Re: If statement with $limit_req_status under location block with proxy_pass not working

2022-06-03 Thread Maxim Dounin
> > limit_req_zone $binary_remote_addr zone=one:1m rate=2r/m; > > server { > > listen 80; > server_name localhost; > > location / { > # set rate limiting for this location > limit_req zone=one burst=10 nodelay; > limit_

If statement with $limit_req_status under location block with proxy_pass not working

2022-06-02 Thread acidiclight
80; server_name localhost; location / { # set rate limiting for this location limit_req zone=one burst=10 nodelay; limit_req_dry_run on; add_header X-my-var "$myvar" always; if ($limit_req_status = "REJECTED_DRY_RUN") {

Re: Newbie location error gives error 404

2022-03-10 Thread James Taylor
Thank you Sergey! I tried every thing I could think of, but I couldn’t think of giving the new directory the correct permissions. Thanks again! ___ nginx mailing list -- nginx@nginx.org To unsubscribe send an email to nginx-le...@nginx.org

Re: newbie location error give error 403

2022-03-08 Thread Sergey A. Osokin
viously, I'm doing something stupid.  Is it really impossible to have > both a documents and an images directory> [...] > >     location /images/ { > root /data; > } >     location /documents/ { > root /data; > } L

newbie location error give error 403

2022-03-08 Thread Jim Taylor
s and an images directory> Jim Taylor server  {     listen 443 ssl;     server_name  www.jstaylor.com;     ssl_certificate /etc/nginx/ssl/combined.crt;     ssl_certificate_key /etc/nginx/ssl/jstaylor.key;     location / {     try_files $uri $u

Re: nginx proxy pass only works for root location

2021-11-18 Thread Maxim Dounin
sted a question: > > > > > > > > https://unix.stackexchange.com/questions/678060/nginx-proxy-pass-only- > > works-for-root-location > > > > First of all you may want to define "won't work". What exactly > > happens, what goes wrong? > >

Re: nginx proxy pass only works for root location

2021-11-18 Thread gunitinug
Maxim Dounin Wrote: --- > Hello! > > On Thu, Nov 18, 2021 at 05:51:08AM -0500, gunitinug wrote: > > > Hello. I posted a question: > > > > > https://unix.stackexchange.com/questions/678060/nginx-proxy-pas

Re: nginx proxy pass only works for root location

2021-11-18 Thread Maxim Dounin
Hello! On Thu, Nov 18, 2021 at 05:51:08AM -0500, gunitinug wrote: > Hello. I posted a question: > > https://unix.stackexchange.com/questions/678060/nginx-proxy-pass-only-works-for-root-location First of all you may want to define "won't work". What exactly happens

nginx proxy pass only works for root location

2021-11-18 Thread gunitinug
Hello. I posted a question: https://unix.stackexchange.com/questions/678060/nginx-proxy-pass-only-works-for-root-location Thanks. Posted at Nginx Forum: https://forum.nginx.org/read.php?2,292884,292884#msg-292884 ___ nginx mailing list nginx

Re: How nginx's "location if" works (Was Re: Setting cache parameters via if directives)

2021-09-28 Thread seekvn
o the essentials and with a few > substitutions > > of actual URIs). > > > > Well, ngx_proxy module's directive inheritance is in action here, > which gives you nice side effects that you want :) > > I'll analyze some examples here such that people *may* get

Re: "proxy_intercept_errors on" with @location setup

2021-09-18 Thread Francis Daly
;ve found to intercept errors is not > > > using the @location but I want to use it to simplify the > > > configuration. > > > > Depending on how you understand "simplify" -- you could potentially > > "include" a file with the common pieces an

Re: "proxy_intercept_errors on" with @location setup

2021-09-17 Thread Fabiano Furtado Pessoa Coelho
Hi Francis... On Thu, Sep 16, 2021 at 7:37 PM Francis Daly wrote: > > On Thu, Sep 16, 2021 at 04:25:59PM -0300, Fabiano Furtado Pessoa Coelho wrote: > > Hi there, > > > Is it possible to use "proxy_intercept_errors on" with @location? > > Yes; but it is

Re: "proxy_intercept_errors on" with @location setup

2021-09-16 Thread Francis Daly
On Thu, Sep 16, 2021 at 04:25:59PM -0300, Fabiano Furtado Pessoa Coelho wrote: Hi there, > Is it possible to use "proxy_intercept_errors on" with @location? Yes; but it is only useful if "proxy_pass" sees the "proxy_intercept_errors". Which means: if the

"proxy_intercept_errors on" with @location setup

2021-09-16 Thread Fabiano Furtado Pessoa Coelho
Hello... I have the following issue... Is it possible to use "proxy_intercept_errors on" with @location? Invalid config: location /images/ { proxy_intercept_errors on; try_files $uri @backend; } location / { try_files $uri @backend; } locatio

Re: Replace location paramter

2021-04-13 Thread Francis Daly
On Tue, Apr 13, 2021 at 05:47:07AM -0400, vybralk wrote: Hi there, > i have ngnix in front of java web server. My request is correctly send by > ngnix to java web, which redirect user request to another url as user is not > authenticated. It set location header to following value >

Replace location paramter

2021-04-13 Thread vybralk
i have ngnix in front of java web server. My request is correctly send by ngnix to java web, which redirect user request to another url as user is not authenticated. It set location header to following value location = https://login.server.com/oidc/2/auth?response_type=code&client_id=123&a

Re: location not working

2021-04-08 Thread Francis Daly
On Thu, Apr 08, 2021 at 04:36:47PM -0400, uragnorson wrote: Hi there, > location / { > root /usr/share/nginx.html; > } > > location /dist/ { > alias /usr/share/nginx/html/dist/; > } Because, in this case, the "location" part matches the end of the "alias&qu

location not working

2021-04-08 Thread uragnorson
On RHEL I have, location / { root /usr/share/nginx.html; } location /dist/ { alias /usr/share/nginx/html/dist/; } I am able to navigate to http://server/dist but in dist the index.html is looking for http://server/js but it should be http:/server/dist/js is there a way to add the extra "

Re: Fwd: Capturing Encoded Location Variable Data

2021-04-08 Thread Maxim Dounin
Hello! On Wed, Apr 07, 2021 at 05:16:20PM -0700, Demitrious Kelly wrote: > Thanks very much. It was not an easy thing to google to get > from symptom to bug report :) From the text in the ticket it > sounds like the named capture functions as intended and if this > bug gets fixed the numeric

Fwd: Capturing Encoded Location Variable Data

2021-04-07 Thread Demitrious Kelly
gin forwarded message: > > From: Maxim Dounin > Subject: Re: Capturing Encoded Location Variable Data > Date: April 7, 2021 at 4:13:58 PM PDT > To: nginx@nginx.org > Reply-To: nginx@nginx.org > > Hello! > > On Wed, Apr 07, 2021 at 03:07:34PM -0700, Demitrious Kelly

Re: Capturing Encoded Location Variable Data

2021-04-07 Thread Maxim Dounin
Hello! On Wed, Apr 07, 2021 at 03:07:34PM -0700, Demitrious Kelly wrote: > Given the following two location configurations: > > location ~ ^/test/named/(?.+)$ { > return 200 $foo; > } > > location ~ ^/test/numbered/(.+)$ { > set $foo $1; > return 200 $foo;

Capturing Encoded Location Variable Data

2021-04-07 Thread Demitrious Kelly
Hello, Given the following two location configurations: location ~ ^/test/named/(?.+)$ { return 200 $foo; } location ~ ^/test/numbered/(.+)$ { set $foo $1; return 200 $foo; } Are the following two results expected? # curl http://127.0.0.1:8088/test/named/%D7%94%D7%98%D7%99%D7%95%D7%9C

May the URI specified with `auth_request` directive, reference capture groups (e.g. `$1`) from containing location?

2021-03-30 Thread J6DKLygdGq139TVZiBxq
Hi all, I may be missing some crucial request processing knowledge, but I am trying to issue an authentication request with variable URI, as as part of processing a request for a protected resource. I hope I am able to express below what I want: ``` location ~ /foo/(\d+)/bar { auth_request

location root not working as described

2021-03-20 Thread John Fowler
Thank you for the pointer. Looks like the problem has been resolved. The location needed a trailing “/“ on the path. location ^~ /.well-known/acme-challenge/ { allow all; alias /var/www/certbot/; try_files $uri =405; } John Working

Re: location root not working as described

2021-03-20 Thread Francis Daly
.1", host: "cyva.lese-fowler.us" "alias" does a straight textual swap of the part in "location" for the part in "alias". Either both should end in /, or neither should. (Usually, both should.) > 2021/03/20 21:44:21 [error] 14#14: *7 open() "/var/w

location root not working as described

2021-03-20 Thread John Fowler
ps://hstspreload.org/. This option # will add the domain to a hardcoded list that is shipped # in all major browsers and getting removed from this list # could take several months. add_header Referrer-Policy "no-referrer" always;

Re: location root not working as described

2021-03-19 Thread Francis Daly
On Fri, Mar 19, 2021 at 03:01:19PM -0700, John Fowler wrote: Hi there, > I have nginx running in a docker container and configured to use let’s > encrypt for certificates services. > The location redirect to /var/www/certbot from /.well-known/acme-challenge > does not seem to work

location root not working as described

2021-03-19 Thread John Fowler
Good Day, I have nginx running in a docker container and configured to use let’s encrypt for certificates services. The location redirect to /var/www/certbot from /.well-known/acme-challenge does not seem to work. Shown below is the contents of the target location and the contents

Re: help need (convert vhost to location)

2020-12-26 Thread Francis Daly
On Tue, Dec 15, 2020 at 07:42:00PM +0200, Gregory Edigarov wrote: Hi there, > I have this server section: ... > now I need to convert this virtual server to location. > i.e. to be called from postmaster.example.com/control/ you will probably want to wrap your current relevant location

help need (convert vhost to location)

2020-12-15 Thread Gregory Edigarov
Hello everybody, I have this server section: server {     server_name postmaster.example.com;     listen 80;     access_log   /var/log/nginx/vexim-access.log;     error_log    /var/log/nginx/vexim-error.log;     root /var/www/vexim/vexim;     index index.php index.htm index.html;     location

Re: Matching of special characters in location

2020-11-10 Thread Francis Daly
On Tue, Nov 10, 2020 at 02:54:26AM +0100, Grzegorz Kulewski wrote: > W dniu 10.11.2020 o 01:19, Francis Daly pisze: Hi there, > > So my config file can include (e.g.) > > > > location ^~/<200b> { return 200 "match /zwsp ($uri, $request_uri)\n"; } > >

Re: Matching of special characters in location

2020-11-09 Thread Grzegorz Kulewski
y to match things like: %e2%80%8b in URL in location? > >>> here is the code snippet (not tested): >>> >>> location ~ ^/\xE2\x80\x8E { >>> return 200 "%e2%80%8b matched\n"/; >>> } >> >> Thank you. It works. >> >

Re: Matching of special characters in location

2020-11-09 Thread Francis Daly
On Tue, Nov 10, 2020 at 12:11:28AM +0100, Grzegorz Kulewski wrote: > W dniu 09.11.2020 o 21:10, Sergey A. Osokin pisze: > > On Mon, Nov 09, 2020 at 03:47:13PM +0100, Grzegorz Kulewski wrote: Hi there, > >> Is there any (sane) way to match things like: %e2%80%8b in URL in loca

Re: Matching of special characters in location

2020-11-09 Thread Grzegorz Kulewski
W dniu 09.11.2020 o 21:10, Sergey A. Osokin pisze: > On Mon, Nov 09, 2020 at 03:47:13PM +0100, Grzegorz Kulewski wrote: >> Hello, >> >> Is there any (sane) way to match things like: %e2%80%8b in URL in location? >> Thank you in advance. > > Hi Grzegorz, > &g

Re: Matching of special characters in location

2020-11-09 Thread Sergey A. Osokin
On Mon, Nov 09, 2020 at 03:47:13PM +0100, Grzegorz Kulewski wrote: > Hello, > > Is there any (sane) way to match things like: %e2%80%8b in URL in location? > Thank you in advance. Hi Grzegorz, here is the code snippet (not tested): location ~ ^/\xE2\x80\x8E { return 200 "

Matching of special characters in location

2020-11-09 Thread Grzegorz Kulewski
Hello, Is there any (sane) way to match things like: %e2%80%8b in URL in location? Thank you in advance. -- Grzegorz Kulewski ___ nginx mailing list nginx@nginx.org http://mailman.nginx.org/mailman/listinfo/nginx

Re: Deny all location ... except

2020-10-26 Thread Francis Daly
t;/TEST/" or "TEST=" or "=TEST" anywhere in the url, you could add the three lines ~/TEST/ 0; ~TEST= 0; ~=TEST 0; inside the map. > I tried to use something like " if ($args = TEST) { allow all;}", > but Nginx gives error " directive is not

Deny all location ... except

2020-10-21 Thread Rejaine Silveira Monteiro
VICE=TEST (allo to all) https:/domain.com/prod/INDEX.apw?TEST=123 (allow to all) https:/domain.com/prod/something/TEST/index.html (allow to all) how to do this? I tried to use something like " if ($args = TEST) { allow all;}", but Nginx gives error " directive is not allowed here

RE: Conditional Proxy Caching in Location

2020-09-17 Thread Igal Sapir
Request, *>* e.g. $req_has_somecookie, and I want to be able to use proxy_cache only for *>* specific URIs, e.g. /slow-page/ if the variable is 0. *> >* I know that "if" is evil as it creates a new location scope. *> >* What's the best way to handle this? * Probab

Re: Conditional Proxy Caching in Location

2020-09-14 Thread Francis Daly
gt; I know that "if" is evil as it creates a new location scope. > > What's the best way to handle this? Probably some combination of http://nginx.org/r/proxy_cache_bypass and http://nginx.org/r/proxy_no_cache You may want to change your variable-setting logic; or use a map (h

Conditional Proxy Caching in Location

2020-09-13 Thread Igal Sapir
Hello, I have a variable that shows if a certain cookie exists in the Request, e.g. $req_has_somecookie, and I want to be able to use proxy_cache only for specific URIs, e.g. /slow-page/ if the variable is 0. I know that "if" is evil as it creates a new location scope. What's

How to call a named location in nginx upon 200 status from upstream server

2020-06-26 Thread Latha Appanna
Hello, I want to call REST endpoint after successful (200/201) status from upstream server. For error cases, I know we can use error_page/try_files etc. But for success cases, I did not find any directive to use. I read about `mirror` which can be used to call another server before making the cal

Re: Location for any Host/ Server

2020-06-09 Thread Thomas Ward
I misread what you were trying to achieve thanks to no coffee this morning. > I do not want to include my file into any server directive. You have **no choice** but to specifically include your location snippets where you want them.  Location blocks can't be applied 'globally'

Re: Location for any Host/ Server

2020-06-09 Thread basti
Does not work. cat /etc/nginx/conf.d/git.conf ## Disable .htaccess and other hidden files server { listen 80 default_server; server_name _; location ~ /\.git { return 404; } location ~ /\.(?!well-known).* { deny all; access_log off; log_not_found off; } } Result is

Re: Location for any Host/ Server

2020-06-09 Thread Thomas Ward
27;t match any other server_name Host so...) Thomas On 6/9/20 11:14 AM, basti wrote: > Hello, > > i want to setup a location match for any hostname/servername like in apache: > > cat /etc/apache2/conf-enabled/git.conf > RedirectMatch 404 /\.git > > In nginx I try > >

Location for any Host/ Server

2020-06-09 Thread basti
Hello, i want to setup a location match for any hostname/servername like in apache: cat /etc/apache2/conf-enabled/git.conf RedirectMatch 404 /\.git In nginx I try cat /etc/nginx/conf.d/git.conf server { ## Disable .htaccess and other hidden files location ~ /\.(?!well-known).* { deny

Re: editing a general location match to exclude one, specific instance?

2020-05-15 Thread Francis Daly
On Thu, May 14, 2020 at 11:10:20AM -0700, PGNet Dev wrote: Hi there, > editing a general location match to exclude one, specific instance? It is usually easier to use positive matches instead of negative ones. > I've had a trivial 'protection' rule in place for a long tim

Re: editing a general location match to exclude one, specific instance?

2020-05-14 Thread PGNet Dev
> Second, it's all in the location documentation: I'm not asking about the order. I'm asking about a specific match(es) that'd work in this specific case. If it's trivial, care to share a working example? ___ nginx maili

Re: editing a general location match to exclude one, specific instance?

2020-05-14 Thread J.R.
First, you forgot to escape the period in settings.php to settings\.php > I'd like to edit the match to PASS that^ logged match -- as > specifically/uniquely as possible -- but CONTINUE to 'deny all' > for all other/remaining matches on "config". Second, it&#

editing a general location match to exclude one, specific instance?

2020-05-14 Thread PGNet Dev
editing a general location match to exclude one, specific instance? I run nginx 1.18.0. I've had a trivial 'protection' rule in place for a long time location ~* (gulpfile\.js|settings.php|readme|schema|htpasswd|password|config) { deny all; } Tha

Re: limit_req at server level gives 404 error for files rewritten at location level?

2020-04-26 Thread J.R.
> In particular, if limit_req uses a map with regular expressions, > this might result in $1.$2 to be set to something completely > different from what was expected from the location matching. > > The general rule is: avoid using positional captures from regular > expressio

Re: limit_req at server level gives 404 error for files rewritten at location level?

2020-04-26 Thread Maxim Dounin
Hello! On Sun, Apr 26, 2020 at 09:59:03AM -0500, J.R. wrote: > I skimmed over the ngx_http_limit_req_module.c and didn't see anything > obvious in relation to file checking, but here's my scenario... > > I have a location block that will re-write the requested 've

limit_req at server level gives 404 error for files rewritten at location level?

2020-04-26 Thread J.R.
I skimmed over the ngx_http_limit_req_module.c and didn't see anything obvious in relation to file checking, but here's my scenario... I have a location block that will re-write the requested 'versioned' file name to the actual common file name, so I can set some things immu

Re: need to preserve / in location

2020-04-24 Thread Gregory Edigarov
onfig     rewrite ^/(admin)$ /$1/ last;     location /admin/ {     index index.html;     root /front;     try_files $uri  admin/index.html; #direct all request to index.html    } and the errors: 2020/04/22 08:35:13 [error] 73#73: *1 open() "/frontindex.html"

Re: need to preserve / in location

2020-04-22 Thread Maxim Dounin
Hello! On Wed, Apr 22, 2020 at 11:46:25AM +0300, Gregory Edigarov wrote: > Hello, Everybody > > this is directory structure: > > /front/admin/index.html > > /front/superadmin/index.html > > that's what I have in config > >     rewrite ^/(ad

Re: need to preserve / in location

2020-04-22 Thread Gregory Edigarov
On 2020-04-22 11:46, Gregory Edigarov wrote: Hello, Everybody this is directory structure: /front/admin/index.html /front/superadmin/index.html that's what I have in config     rewrite ^/(admin)$ /$1/ last;     location /admin/ {     index index.html;     root /

need to preserve / in location

2020-04-22 Thread Gregory Edigarov
Hello, Everybody this is directory structure: /front/admin/index.html /front/superadmin/index.html that's what I have in config     rewrite ^/(admin)$ /$1/ last;     location /admin/ {     index index.html;     root /front;     try_files $uri  admin/index

Re: Nginx location - Distinguish requests by arguments or queries

2020-02-27 Thread Francis Daly
On Thu, Feb 27, 2020 at 02:20:45PM -0500, stmx38 wrote: Hi there, > 1. "~*" to be "~^" > The first one looks like Nginx regexp we can use for locations, but the > second one not (^~): "map" is documented at http://nginx.org/r/map "~" means "this arg is a regex, not a string". "~*" means "and th

Re: Nginx location - Distinguish requests by arguments or queries

2020-02-27 Thread stmx38
/community/tutorials/understanding-nginx-server-and-location-block-selection-algorithms 2. It seems that the order of records in map is important. We pass required queries with args, we block then all queries with args and allow without args a then default value is applied. Maybe you can provide more deta

Re: Nginx location - Distinguish requests by arguments or queries

2020-02-26 Thread Francis Daly
On Tue, Feb 25, 2020 at 05:06:15PM +, Francis Daly wrote: > On Tue, Feb 25, 2020 at 07:05:05AM -0500, stmx38 wrote: Hi there, two corrections to my suggestion... > > For location /test we should permit only POST, for /test?doc we should > > permit only GET methods. &

Re: Nginx location - Distinguish requests by arguments or queries

2020-02-25 Thread Francis Daly
On Tue, Feb 25, 2020 at 07:05:05AM -0500, stmx38 wrote: Hi there, > We have a case when we should permit different methods on the same location > but different requests. The nginx model does "location" matching without reference to the query string. But you may be able to buil

Nginx location - Distinguish requests by arguments or queries

2020-02-25 Thread stmx38
Hello, We have a case when we should permit different methods on the same location but different requests. For location /test we should permit only POST, for /test?doc we should permit only GET methods. Our config example: location /test { error_page 403 =405 /custom-error

  1   2   3   4   5   6   7   8   >