# Force "internal" directive to display a custom 404?

**URL:** <https://www.ruby-forum.com/t/force-internal-directive-to-display-a-custom-404/221950>\
**Category:** NGINX\
**Created:** [August 6, 2012, 11:32pm UTC](https://www.ruby-forum.com/t/force-internal-directive-to-display-a-custom-404/221950 "2012-08-06T23:32:24Z")\
**Posts on this page:** 3\
**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:** [August 6, 2012, 11:32pm UTC](https://www.ruby-forum.com/t/force-internal-directive-to-display-a-custom-404/221950/1 "2012-08-06T23:32:24Z")

</div>

Example:

error\_page 404 /404.html;

location = /404.html {  
internal;  
}

location /alpha {  
internal;  
}

The proper behavior would be to display the custom 404.html in every  
case, which does not.  
I’m not sure this could be marked as new feature, or is feasible with  
some configuration I don’t know about it?

Thanks.

Posted at Nginx Forum:

> **[Force "internal" directive to display a custom 404?](https://forum.nginx.org/read.php?2,229365,229365#msg-229365)**
>
> Example: error\_page 404 /404.html; location = /404.html { internal; } location /alpha { internal; } The proper behavior would be to display the custom 404.html in every case, which does not. I'm no

---

<div class="post-metadata">

**Author:** ![teck](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/b2d939/32.png) [@teck](https://www.ruby-forum.com/u/teck)\
**Post date:** [August 7, 2012, 3:41pm UTC](https://www.ruby-forum.com/t/force-internal-directive-to-display-a-custom-404/221950/2 "2012-08-07T15:41:09Z")

</div>

Hello!

On Mon, Aug 06, 2012 at 05:31:50PM -0400, TECK wrote:

> }
> 
> The proper behavior would be to display the custom 404.html in every  
> case, which does not.  
> I’m not sure this could be marked as new feature, or is feasible with  
> some configuration I don’t know about it?

Do you actually have 404.html file under document root? The above  
config properly returns custom 404 for “/404.html”, “/alpha”, and  
“/alpha/foo” requests here, just tested.

Maxim D.

---

<div class="post-metadata">

**Author:** ![teck](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/b2d939/32.png) [@teck](https://www.ruby-forum.com/u/teck)\
**Post date:** [August 7, 2012, 3:51pm UTC](https://www.ruby-forum.com/t/force-internal-directive-to-display-a-custom-404/221950/3 "2012-08-07T15:51:43Z")

</div>

Hi Maxim,

The problem was located somewhere between my seat and the computer  
screen. 🙂  
I forgot to add the error\_page 404 /404.html; condition into ssl  
server… doh.

Regards,

Floren

Posted at Nginx Forum:

> **[Re: Force "internal" directive to display a custom 404?](https://forum.nginx.org/read.php?2,229365,229391#msg-229391)**
>
> Example: error\_page 404 /404.html; location = /404.html { internal; } location /alpha { internal; } The proper behavior would be to display the custom 404.html in every case, which does not. I'm no
