WebFaction
Community site: login faq

I have a somewhat strange configuration: I'm using an .htaccess file + a RewriteRule proxy to send some URLs to another webfaction app, Django.

Brief summary:

.htaccess:
RewriteEngine On
RewriteBase /
RewriteRule ^(hello|example2|example3)(/.*)?$ http://127.0.0.1:MAGIC_PORT_NUMBER/$1$2 [P]
...

This works great, in that if someone goes to /hello/working-url then they will be magically transported to the Django instance. No worries so far.

HOWEVER, if they go to /hello/link-that-django-generates-a-404-for then I do not see the beautiful Django 404.html template I'm expecting. (I do see this template in development, and if I use links to go to http://127.0.0.1:MAGIC_PORT_NUMBER/xyz I do see the 500.html error I'm expecting because 127.0.0.1 is not in the authorized hosts list.)

In summary, is it possible that Apache's ErrorDocument is taking over when it receives a 404 error from Django, and serving that ErrorDocument rather than Django's 404.html? & if so, can I make Apache just serve the content straight?

asked 18 Jul '13, 12:14

borwick
1124
accept rate: 0%


Its hard to say without testing it further. What are the results of

curl -vv example.com/hello/link-that-django-generates-a-404

You may submit a support ticket if you would like us to look directly.

permanent link

answered 18 Jul '13, 17:09

johns
5.4k312
accept rate: 23%

OK--here goes:

$ curl -vv www.example.com/hello/link-that-django-generates-a-404
* About to connect() to www.example.com port 80 (#0)
*   Trying [IP-ADDRESS-REDACTED]...
* Adding handle: conn: 0x7f970a007200
* Adding handle: send: 0
* Adding handle: recv: 0
* Curl_addHandleToPipeline: length: 1
* - Conn 0 (0x7f970a007200) send_pipe: 1, recv_pipe: 0
* Connected to www.example.com ([IP-ADDRESS-REDACTED]) port 80 (#0)
> GET /hello/link-that-django-generates-a-404 HTTP/1.1
> User-Agent: curl/7.31.0
> Host: www.example.com
> Accept: */*
> 
< HTTP/1.1 404 NOT FOUND
* Server nginx is not blacklisted
< Server: nginx
< Date: Fri, 19 Jul 2013 01:46:03 GMT
< Content-Type: text/html; charset=iso-8859-1
< Content-Length: 236
< Connection: keep-alive
< Vary: Accept-Encoding
< Vary: Accept-Encoding
< 
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>404 NOT FOUND</title>
</head><body>
<h1>NOT FOUND</h1>
<p>The requested URL /hello/link-that-django-generates-a-404 was not found on this server.</p>
</body></html>
* Connection #0 to host www.example.com left intact
(18 Jul '13, 20:49) borwick

Is it possible that "proxy intercept errors" is set?

(18 Jul '13, 20:53) borwick

No, we're not using proxy_intercept_errors in our front-end nginx config. Please open a support ticket so that we can have a look at your actual site and application. Thanks!

(19 Jul '13, 14:38) seanf
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×225
×25
×22

question asked: 18 Jul '13, 12:14

question was seen: 2,862 times

last updated: 19 Jul '13, 14:40

WEBFACTION
REACH US
SUPPORT
AFFILIATE PROGRAM
LEGAL
© COPYRIGHT 2003-2019 SWARMA LIMITED - WEBFACTION IS A SERVICE OF SWARMA LIMITED
REGISTERED IN ENGLAND AND WALES 5729350 - VAT REGISTRATION NUMBER 877397162
5TH FLOOR, THE OLD VINYL FACTORY, HAYES, UB3 1HA, UNITED KINGDOM