Configure proxy for outgoing HTTP-Requests

Hi,

I need a proxy to access the internet from the server that’s running InvoiceNinja. Is there an option to configure a proxy and credentials for it in InvoiceNinja somewhere? I tried to check the documentation but couldn’t find anything.

Hi,

The info here may help:

That’s for a reverse proxy, I need a forward proxy though that is used when checking for updates, generating PDF-Files and so on.

@david do you have any suggestions?

I haven’t dealt with anything like this, nor is there anything in the application to support anything like this I don’t think.

I’ve checked the source code aswell and apparently it’s indeed not supported. However, adding support for this isn’t really straight forward as multiple libraries are issuing HTTP requests aswell and some don’t support passing the proxy through. It would be necessary to specify an option whenever a http client is initialized, see api - How to set proxy in Http request in Laravel 7? - Stack Overflow

You’ll just need to add a few lines to your .env file with the proxy settings.

Which lines do you mean? Or how are the relevant parameters called?

@flole

you’ll want to investigate whether anyone has done with with a Laravel Project.

That is what we’ve built this on, so if someone has already done the work, it would be work looking at what solution they came up with.

I did that a while ago, the problem here is that there are several ways of sending requests from invoiceninja. Some requests use guzzlehttp (which respects some environment-variables), others use some “professional” curl wrapper which also respects environment variables and some also use app/Utils/CurlUtils.php which currently has no support for setting the proxy at all. I tried to implement it but failed miserably. Hardcoding works, using a value from the .env doesn’t when I tried to do it like this:

CURLOPT_PROXY => Utils::getenv('ALL_PROXY'),

I’ve never worked with Laravel before so this might be completely wrong.