# Goto @loc; / return @loc;

**URL:** <https://www.ruby-forum.com/t/goto-loc-return-loc/246207>\
**Category:** NGINX\
**Created:** [September 11, 2013, 7:22am UTC](https://www.ruby-forum.com/t/goto-loc-return-loc/246207 "2013-09-11T07:22:56Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sadaf\_N](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/858c86/32.png) [@Sadaf\_N](https://www.ruby-forum.com/u/Sadaf_N)\
**Post date:** [September 11, 2013, 7:22am UTC](https://www.ruby-forum.com/t/goto-loc-return-loc/246207/1 "2013-09-11T07:22:56Z")

</div>

Hi

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
