ERROR 503 - Service Unavailable - The timeout specified has expired

After I updated to Invoice Ninja v4.5.16 (self hosted) my clients receive email with new invoice and when they click on button VIEW INVOICE, the page is not opening after 2-minutes they get ERROR 503 - Service Unavailable!

Error Log shows
[Tue Nov 12 20:51:36.206660 2019] [proxy_fcgi:error] [pid 24803] (70007)The timeout specified has expired: [client XX.XXX.123.232:65059] AH01075: Error dispatching request to : (polling)

Any ideas how to troubleshoot the issue?
Thanks in advance.

Can you confirm value for APP_URL in the .env file is correct

.env currently has

i also tried to switch URL to this
same issue

Is this your first time upgrading the app? Is it possible you made manual changes to the htaccess or other files when first installing which were overwritten by the upgrade.

Hi Hillel, thanks in advance for your help. I used these steps to update (I have updated 3x times in the past using similar steps):

STEP 1 > change to folder cd /var/www/clients/client1/web1/web/billing
STEP 2 > create file > touch ninja-update
STEP 3 > open up file > nano ninja-update (paste code from script

STEP 4 > make file executable > chmod +x ninja-update
STEP 5 > run script > ./ninja-update
STEP 6 > copy all files from “public” folder and paste it to root “/” folder
STEP 7 > open and modify INDEX.PHP file > nano /var/www/clients/client1/web1/web/billing/index.php

require DIR.’/…/bootstrap/autoload.php’;
require DIR.’/bootstrap/autoload.php’;

$app = require_once DIR.’/…/bootstrap/app.php’;
$app = require_once DIR.’/bootstrap/app.php’;

My .htaccess file content is:

<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews

RewriteEngine On

Redirect Trailing Slashes…

RewriteRule ^(.*)/$ /$1 [L,R=301]

Handle Front Controller…

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]

RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

In case of running InvoiceNinja in a Subdomain like,

you have to enable the following line:

RewriteBase /


<IfModule mod_headers.c>

Blocks Search Engine Indexing

Header set X-Robots-Tag “noindex, nofollow”

Sorry, I’m not sure. You shouldn’t have to change the boostrap URL?

What I’ve noticed, If I’m logged in to invoiceninja and go to the clients email (i have a copy) and click on VIEW INVOICE, link opens. If i logout, I get error: ERROR 503 – Service Unavailable – The timeout specified has expired.

Sorry, I’m not sure

If you want to email the URL for the app and a sample “View in portal” link to I can compare them.

I just emailed client’s INVOICE EMAIL to
Thanks for taking time to look into this.

I didn’t see the email? Do you want to resend it.

Resent twice from my email and my gmail. Let me know if you didn’t receive it. Again, thanks for looking.

Thanks, got it this time.

The links look correct, I’m not sure what would cause this.

If I enter payment and client gets confirmation email about payment (with link) link does work. Any other suggestion why initial LINK within email does not work. Could this be server or app related issue?

Sorry, I’m not sure. As mentioned earlier you shouldn’t need to make any code changes to get the app running, you may want to try setting up a clean install.

Thank you Hillel!

If I clean install would I:

  1. Export existing DATA under BASIC SETTINGS > EXPORT | IMPORT as CSV
  2. Import existing DATA under BASIC SETTINGS > EXPORT | IMPORT as CSV

If you’re moving between self host installs it’s best to use mysqldump, hosted users should use JSON.

I reinstalled it and it works now. Thanks for all of your help.