goto @loc; / return @loc;

etienne.champetier at etienne.champetier at
Wed Sep 11 05:22:12 UTC 2013


Here is a simplified example of my nginx config

location /loc1 {
    location ~ \.(css|js)$ {
        try_files $uri @loc1;
    return 599;
    error_page 599 = @loc1;
location @loc1 {
    fastcgi_index index.aspx; # Page par defaut
    fastcgi_pass unix:/tmp/loc1.sock;

The idea is that I have over 20 location for 20 fastcgi applications.
I want the .css & .js to be served by nginx if they exist else let the fastcgi app handle the request.
The named location can be more complicated (i want to avoid copy/paste)

First is my config ok (it's working but is it "best practice")?

Second what do you think of a new "goto @loc1" or "return @loc1" directive?
The return / error_page combo is a bit of a hack.
I'm willing to write a patch if devs think it a good/valid use case.

Thanks in advance

More information about the nginx mailing list