404 with require_https and cloudflare

My site is using a subdomain for invoice ninja http://invoice.mywebsite.com

The site is hosted with GoDaddy on a shared server.

I have a Cloudflare A record configured to point to my host IP which will serve the website over HTTPS

As soon as I turn on REQUIRE_HTTPS=true in .env - I am unable to access the site over HTTPS.

The APP_URL in .env is set to https://invoice.mywebsite.com

My site works absolutely fine over HTTP

Can anyone help?

Almost able to resolve my own issue

Changed Cloudflare SSL type from Full to Flexible

I get an error:

If I change TRUSTED_PROXIES in env to TRUSTED_PROXIES="*" it then works over HTTPS however not recommended

Can anyone advise how this can be secured?

If you know the IPs you could specify them rather than use *

Hi Hillel, I tried this but got the same issue

I’m not too familiar with Laravel - perhaps the syntax is incorrect?


I think you have too many quotes, it should be “ip,ip,ip,…”

Tried that also but same issue

I will continue to work on a solution and post here when resolved

Did you figure this out? I’m using nginx (proxy_pass) for invoice ninja and I have only been able to get it work if I specify an (*) asterisk as TRUSTED_PROXIES.

I tried specifying a single IP address of nginx but that didn’t work. I also tried CIDR notation, also did not work.

Does anyone know that TRUSTED_PROXIES actually does?

TRUSTED_PROXIES accepts a comma delimited list of subnets


Yea. I tried exactly

which is basically *

…but they don’t work equally.

After I put the right IP address it worked. Lol. Not sure where I came up with the IP I tried originally. Brain fart.