# Try\_files doesn't work after $args rewite?

**URL:** <https://www.ruby-forum.com/t/try-files-doesnt-work-after-args-rewite/215012>\
**Category:** NGINX\
**Created:** [December 19, 2011, 3:11pm UTC](https://www.ruby-forum.com/t/try-files-doesnt-work-after-args-rewite/215012 "2011-12-19T15:11:01Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![luislavena](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/0ea827/32.png) [@luislavena](https://www.ruby-forum.com/u/luislavena)\
**Post date:** [December 19, 2011, 3:11pm UTC](https://www.ruby-forum.com/t/try-files-doesnt-work-after-args-rewite/215012/1 "2011-12-19T15:11:01Z")

</div>

Hello

Directive try\_files doesn’t work after rewriting $args:

location / {

# remove auth key from query string

if ($args ~ ^(._)&?auth=[^&]+(._)) {  
set $args “$1$2”;  
}

try\_files $uri $uri/ @webapp;  
}

location @webapp {

# send request to upstream

proxy\_pass http://some\_upstream;  
}

Log:

2011/12/19 15:05:16 [error] 29913#0: \*40 open()  
“/var/www/sth/Rest.svc/event/5826710” failed (2: No such file or  
directory), client: 172.16.16.81, server: [epg.siol.tv](http://epg.siol.tv), request: “GET  
/sth/Rest.svc/event/5826710?auth=blahblahblah HTTP/1.1”, host:  
“[epg.siol.tv](http://epg.siol.tv)”

What am i doing wrong?

Best regards, Brane

---

<div class="post-metadata">

**Author:** ![SSBrane\_FSGraSSnar](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/a9adbd/32.png) [@SSBrane\_FSGraSSnar](https://www.ruby-forum.com/u/SSBrane_FSGraSSnar)\
**Post date:** [December 19, 2011, 3:17pm UTC](https://www.ruby-forum.com/t/try-files-doesnt-work-after-args-rewite/215012/2 "2011-12-19T15:17:51Z")

</div>

Hello!

On Mon, Dec 19, 2011 at 03:11:06PM +0100, “Brane F. Gračnar” wrote:

> try\_files $uri $uri/ @webapp;  
> “/var/www/sth/Rest.svc/event/5826710” failed (2: No such file or  
> directory), client: 172.16.16.81, server: [epg.siol.tv](http://epg.siol.tv), request: “GET  
> /sth/Rest.svc/event/5826710?auth=blahblahblah HTTP/1.1”, host: “[epg.siol.tv](http://epg.siol.tv)”
> 
> What am i doing wrong?

> **[GitHub - nginxinc/nginx-wiki: ARCHIVED -- Source for the now archived NGINX Wiki...](https://github.com/nginxinc/nginx-wiki)**
>
> ARCHIVED -- Source for the now archived NGINX Wiki section of https://www.nginx.com

Maxim D.
