# Error\_page without content type

**URL:** <https://www.ruby-forum.com/t/error-page-without-content-type/228982>\
**Category:** NGINX\
**Created:** [May 14, 2013, 11:48pm UTC](https://www.ruby-forum.com/t/error-page-without-content-type/228982 "2013-05-14T23:48:30Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![enduro](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/5f8ce5/32.png) [@enduro](https://www.ruby-forum.com/u/enduro)\
**Post date:** [May 14, 2013, 11:48pm UTC](https://www.ruby-forum.com/t/error-page-without-content-type/228982/1 "2013-05-14T23:48:30Z")

</div>

Hi

I’m setting a custom 404 page with:

server {  
…  
error\_page 404 /errors/not-found.html;  
}

And the page looks as follows:

\<link

href=“/favicon.ico” rel=“shortcut icon” type=“image/vnd.microsoft.icon”  
/\>

 ![Wmkt-logo](https://www.ruby-forum.com/assets/wmkt-logo-fdb0e2494a44ea8b38242b1bf1ae5f9a.png)  
  

## Seite nicht gefunden

Die angeforderte Seite existiert  
nicht.

* * *

## Page non trouvée

Cette page n’éxiste  
pas.

* * *

## Page Not Found

This page does not exist.

* * *

This is what I get with “curl -i [http://wemakeit.ch/cache/doesnotexist](http://wemakeit.ch/cache/doesnotexist)”:

HTTP/1.1 404 Not Found  
Transfer-Encoding: chunked  
Connection: keep-alive  
Keep-Alive: timeout=20  
Status: 404 Not Found  
X-Request-Id: 6fc3d91efbddf9a5f9dbf32f6d4aff32  
X-Runtime: 0.002343  
Date: Tue, 14 May 2013 21:46:48 GMT  
X-Rack-Cache: miss  
X-Content-Type-Options: nosniff  
X-Powered-By: Phusion Passenger 4.0.2  
Server: nginx/1.2.6 + Phusion Passenger 4.0.2

There’s not Content-Type header, which is why Chrome shows the page  
source  
instead of rendering the HTML.

Any idea what I’m doing wrong here?

Thanks!

---

<div class="post-metadata">

**Author:** ![enduro](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/5f8ce5/32.png) [@enduro](https://www.ruby-forum.com/u/enduro)\
**Post date:** [May 15, 2013, 12:09am UTC](https://www.ruby-forum.com/t/error-page-without-content-type/228982/2 "2013-05-15T00:09:32Z")

</div>

On Tue, May 14, 2013 at 5:47 PM, Svoop [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Hi
> 
> I’m setting a custom 404 page with:
> 
> server {  
> …  
> error\_page 404 /errors/not-found.html;  
> }

…

> Any idea what I’m doing wrong here?
> 
> Thanks!

Looks like your 404s are being generated by a backend, not by nginx. You  
may want to use fastcgi\_intercept\_errors / proxy\_intercept\_errors.

---

<div class="post-metadata">

**Author:** ![enduro](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/5f8ce5/32.png) [@enduro](https://www.ruby-forum.com/u/enduro)\
**Post date:** [May 15, 2013, 1:21pm UTC](https://www.ruby-forum.com/t/error-page-without-content-type/228982/3 "2013-05-15T13:21:04Z")

</div>

Richard S. \<r1ch+nginx@…\> writes:

> Looks like your 404s are being generated by a backend, not by nginx. You  
> may want to use fastcgi\_intercept\_errors / proxy\_intercept\_errors.

You’re right, but since the pages are served via Passenger, these  
directives  
won’t work. However, I found a way to pass the correct content type in  
the  
routing table.

Thanks!

---

<div class="post-metadata">

**Author:** ![enduro](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/5f8ce5/32.png) [@enduro](https://www.ruby-forum.com/u/enduro)\
**Post date:** [May 15, 2013, 3:09pm UTC](https://www.ruby-forum.com/t/error-page-without-content-type/228982/4 "2013-05-15T15:09:09Z")

</div>

2013/5/15 Svoop [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):

> However, I found a way to pass the correct content type in the routing table.

… which you may want to share, so that later people can look for a  
working solution?

Regards, Andre
