# Internally redirected requests

**URL:** <https://www.ruby-forum.com/t/internally-redirected-requests/224674>\
**Category:** NGINX\
**Created:** [November 21, 2012, 12:12pm UTC](https://www.ruby-forum.com/t/internally-redirected-requests/224674 "2012-11-21T12:12:59Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![aris](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/258eb7/32.png) [@aris](https://www.ruby-forum.com/u/aris)\
**Post date:** [November 21, 2012, 12:12pm UTC](https://www.ruby-forum.com/t/internally-redirected-requests/224674/1 "2012-11-21T12:12:59Z")

</div>

How to do internal redirect (which is the best way)? I do not want to  
apply  
to this “include”.  
Maybe I can do something like this:

location /a { alias @app; }  
location /b { alias @app; }

location @app { … }

Should I use to this “error\_page” or “try\_files” if I do not dealing  
with  
static files ?

Posted at Nginx Forum:

> **[internally redirected requests](https://forum.nginx.org/read.php?2,233074,233074#msg-233074)**
>
> How to do internal redirect (which is the best way)? I do not want to apply to this "include". Maybe I can do something like this: location /a { alias @app; } location /b { alias @app; } location @app { ... } Should I use to this &

---

<div class="post-metadata">

**Author:** ![nri.pl](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/dec6dc/32.png) [@nri.pl](https://www.ruby-forum.com/u/nri.pl)\
**Post date:** [November 21, 2012, 12:22pm UTC](https://www.ruby-forum.com/t/internally-redirected-requests/224674/2 "2012-11-21T12:22:20Z")

</div>

On Wed, Nov 21, 2012 at 6:12 PM, nri.pl [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> static files ?

you can use `try_files /nonexistent @app;` though I’m interested why  
don’t you want to use include.

---

<div class="post-metadata">

**Author:** ![nri.pl](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/dec6dc/32.png) [@nri.pl](https://www.ruby-forum.com/u/nri.pl)\
**Post date:** [November 21, 2012, 12:52pm UTC](https://www.ruby-forum.com/t/internally-redirected-requests/224674/3 "2012-11-21T12:52:08Z")

</div>

Heterogeneous environment.  
I can not use “incude” because the configuration file is generated by  
the  
application. I am responsible for the deployment. Problematic is for  
application developers to generate and manage multiple configuration  
files,  
much easier to manage one file.

Posted at Nginx Forum:

> **[Re: internally redirected requests](https://forum.nginx.org/read.php?2,233074,233080#msg-233080)**
>
> How to do internal redirect (which is the best way)? I do not want to apply to this "include". Maybe I can do something like this: location /a { alias @app; } location /b { alias @app; } location @app { ... } Should I use to this &

---

<div class="post-metadata">

**Author:** ![nri.pl](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/dec6dc/32.png) [@nri.pl](https://www.ruby-forum.com/u/nri.pl)\
**Post date:** [November 21, 2012, 4:13pm UTC](https://www.ruby-forum.com/t/internally-redirected-requests/224674/4 "2012-11-21T16:13:46Z")

</div>

On Wed, Nov 21, 2012 at 06:12:40AM -0500, nri.pl wrote:

> static files ?  
> location /a {  
> return 418;  
> error\_page 418 = @teapot;  
> }

location /b {  
return 418;  
error\_page 418 = @teapot;  
}

location @teapot {  
return 200 “uri=$uri\nargs=$args\n”;  
}

See:

> **[Module ngx\_http\_core\_module](http://nginx.org/en/docs/http/ngx_http_core_module.html#internal)**
>
> This directive appeared in version 1.11.8.

> **[Module ngx\_http\_core\_module](http://nginx.org/en/docs/http/ngx_http_core_module.html#error_page)**
>
> This directive appeared in version 1.11.8.
