1

I would like my ordinary Rails error pages to be passed on to the user-agent. I can of course customize these pages using normal Rails techniques.

But if there's an internal passenger error (usually when passenger can't start the app at all), I would like to customize that page. Is there any way to do that?

If I (apache) set PassengerErrorOverride on, then I can configure the internal passenger error page on the apache side -- but I also lose all of my customized ordinary Rails error pages, I think.

Is there any way to keep my custom Rails error page bodies under normal operation, but still customize the internal Passenger fatal error screen somehow?

Thanks!

jrochkind
  • 22,799
  • 12
  • 59
  • 74

1 Answers1

1

Let's see if I understand correctly. If the user is served with for example an HTTP 500 error page, this can come from three different sources:

  1. Your rails app (usually)
  2. Passenger (probably rarely, e.g. spawn error)
  3. Apache (overrides 1. and 2.)

And what you would like is for the user to get: 1. + (customized by you) 2.

The default way to override 2. is indeed to use option 3., but that would also override 1., which you don't want.

I don't think there is presently another option in Passenger to override 2., but you could overwrite the template that Passenger uses. In case friendly error pages are set to off, the template is:

`passenger-config about resourcesdir`/templates/undisclosed_error.html.template
OnixSO
  • 136
  • 2
  • yes, you understand correctly. I think overriding the template will indeed do what I need, although I guess I'd have to remember to re-overwrite any time I upgrade Passenger to a new version? That is obviously un-optimal. If anyone from Phusion is reading this, I'd recommend making this a config option, perhaps simply config the path to use for that template. – jrochkind Dec 16 '17 at 17:05
  • although I guess I can have my capistrano deploy script copy a template to the overwrite location on every deploy, that is at least a little bit better. – jrochkind Dec 16 '17 at 17:05