Client Portal registration and PDF Generator not working under reverse proxy and Cloudflare

Hi guys docker installation here. I have two little problems with InvoiceNinja exposed under Nginx Proxy Manager and Cloudflare.
The first one is about Cloud Portal registration where if I open the generated link I receive an HTTP 400 Bad Request and it doesn’t work with domain and in local both… any ideas?

Another problem is about PDF Generator, with the domain it doesn’t work, with local IP works.
I receive this error: PlatformException(error, NoSuchMethodError: method not found:‘getDocument’ on null,null,null)
Opening chrome console I noticed this line Mixed Content: The page at 'https://invoice.domainname.com/#/' was loaded over HTTPS, but requested an insecure script 'http://invoice.domainname.com/js/pdf.min.js'. This request has been blocked; the content must be served over HTTPS.

My env file:
   # IN application vars
APP_URL=https://invoice.domainname.com
APP_KEY=base64:....
APP_DEBUG=false
REQUIRE_HTTPS=false
PHANTOMJS_PDF_GENERATION=false
PDF_GENERATOR=snappdf

TRUSTED_PROXIES='103.21.244.0/22,
103.22.200.0/22,
103.31.4.0/22,
104.16.0.0/13,
104.24.0.0/14,
108.162.192.0/18,
131.0.72.0/22,
141.101.64.0/18,
162.158.0.0/15,
172.64.0.0/13,
173.245.48.0/20,
188.114.96.0/20,
190.93.240.0/20,
197.234.240.0/22,
198.41.128.0/17' #Cloudflare IPs

QUEUE_CONNECTION=database

# DB connection
DB_HOST=db
DB_PORT=3306
DB_DATABASE=ninja
DB_USERNAME=ninja
DB_PASSWORD=apassword

# Create initial user
# Default to these values if empty
# IN_USER_EMAIL=admin@example.com
# IN_PASSWORD=changeme!
IN_USER_EMAIL=
IN_PASSWORD=



# MySQL
MYSQL_ROOT_PASSWORD=asuperpassword
MYSQL_USER=ninja
MYSQL_PASSWORD=apassword
MYSQL_DATABASE=ninja

# V4 env vars
# DB_STRICT=false
# APP_CIPHER=AES-256-CBC

Thank you

try

TRUSTED_PROXIES=*

this will confirm the issue.

Next, I believe you only need to insert the IP address of YOUR proxy into the TRUSTED_PROXIES variable, not Cloudflare IP range

1 Like

Thank you! Inserted local reverse proxy ip address and PDF issue disappears, but Client Portal registration one is still there…
On console I see Failed to load resource: the server responded with a status of 400 ()
Any ideas?

Registration is enabled in webUI

https://invoice.domainname.com/client/register works, but that url with COMPANY_KEY doesn’t