500 Error when editing PDF invoice templates : potential fix

Hi,

I read quite a few threads about 500 errors linked to PDF since my template editor started giving me 500 errors, too.

I was pulling my hair quite a bit since yesterday and I was in the process of writing a long debugging thread until I found the exact problem, so that might affect others: my glitch was due to ModSecurity running on my server. Simply disabling it on the subdomain I have Invoice Ninja installed on fixed all the errors that would be triggered when trying to create/load/view/edit/save templates.

Curiously, the “Playful” template was the only one working fine with ModSecurity, and I tried on a test install to copy its data under the “design” column in the database to the “Hipster” entry, and to my surprise, “Hipster” started loading too. It thus seems that ModSecurity might be parsing and flagging wrongly something in the html source for some templates in the database, since it allows some specific code and makes some other code crash.

So all in all, for those getting 500 Errors with template editing or PDF generation, this might do the trick.

Hi,

Thanks for sharing this!

cc @david @ben

1 Like

Thanks for the tip! Do you mind sending us a pull request to update the docs with this information?

Hi Ben,

I’d gladly do that, but I’m not sure how to do that exactly. I clicked on your link and when I click on New pull request I get Choose different branches or forks above to discuss and review changes. Not sure what to compare to what from there…

No worries, if you want I can update it, however, this is how to do it:

  1. Open any page on the https://invoiceninja.github.io, for example Free Source Available Invoicing, Expenses & Time-Tracking | Invoice Ninja

  2. On the bottom of the page click: " Want to contribute? Edit this page on GitHub"

  3. image

  4. After the changes you should have a fork of the docs & now you can compare your branch (usually starts with patch to v5-rework).

Thanks.

No worries, if you want I can update it

Hi @ben , great, if you could do it for me this once that would be awesome; I’ll try your steps more in detail next time :slight_smile:

1 Like