Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No access to the marketplace with an environment requiring the use of a proxy #1989

Open
Antalis opened this issue May 7, 2024 · 1 comment

Comments

@Antalis
Copy link

Antalis commented May 7, 2024

Organizr Version: V 2.1.2490
Branch: Master
WebServer: Nginx
Operating System: Docker container (with Alpine)

Problem Description:

The 2 default marketplaces (customize & plugins) are not accessible with a flow that must go through a proxy.


Reproduction Steps:

With an environment that cannot output directly and therefore requires a proxy
http://ORGANIZR_IP:ORGANIZR_PORT/api/v2/sponsors/all

Slim` Application Error

The application could not run because of the following error:
Details
Type: Requests_Exception
Code: 0
Message: cURL error 6: Could not resolve host: github.com
File: /config/www/organizr/api/vendor/rmccue/requests/library/Requests/Transport/cURL.php
Line: 443
Trace

#0 /config/www/organizr/api/vendor/rmccue/requests/library/Requests/Transport/cURL.php(179): Requests_Transport_cURL->process_response()
#1 /config/www/organizr/api/vendor/rmccue/requests/library/Requests.php(381): Requests_Transport_cURL->request()
#2 /config/www/organizr/api/vendor/rmccue/requests/library/Requests.php(233): Requests::request()
#3 /config/www/organizr/api/classes/organizr.class.php(6127): Requests::get()
#4 /config/www/organizr/api/classes/organizr.class.php(6165): Organizr->getGithubSponsors()
#5 /config/www/organizr/api/v2/routes/sponsors.php(20): Organizr->getAllSponsors()
#6 /config/www/organizr/api/vendor/slim/slim/Slim/Handlers/Strategies/RequestResponse.php(43): {closure}()
#7 /config/www/organizr/api/vendor/slim/slim/Slim/Routing/Route.php(384): Slim\Handlers\Strategies\RequestResponse->__invoke()
#8 /config/www/organizr/api/vendor/slim/slim/Slim/MiddlewareDispatcher.php(81): Slim\Routing\Route->handle()
#9 /config/www/organizr/api/vendor/slim/slim/Slim/MiddlewareDispatcher.php(81): Slim\MiddlewareDispatcher->handle()
#10 /config/www/organizr/api/vendor/slim/slim/Slim/Routing/Route.php(341): Slim\MiddlewareDispatcher->handle()
#11 /config/www/organizr/api/vendor/slim/slim/Slim/Routing/RouteRunner.php(84): Slim\Routing\Route->run()
#12 /config/www/organizr/api/vendor/slim/slim/Slim/Middleware/RoutingMiddleware.php(59): Slim\Routing\RouteRunner->handle()
#13 /config/www/organizr/api/vendor/slim/slim/Slim/MiddlewareDispatcher.php(147): Slim\Middleware\RoutingMiddleware->process()
#14 /config/www/organizr/api/vendor/slim/slim/Slim/Middleware/ErrorMiddleware.php(107): Psr\Http\Server\RequestHandlerInterface@anonymous->handle()
#15 /config/www/organizr/api/vendor/slim/slim/Slim/MiddlewareDispatcher.php(147): Slim\Middleware\ErrorMiddleware->process()
#16 /config/www/organizr/api/v2/index.php(92): Psr\Http\Server\RequestHandlerInterface@anonymous->handle()
#17 /config/www/organizr/api/vendor/slim/slim/Slim/MiddlewareDispatcher.php(313): {closure}()
#18 /config/www/organizr/api/vendor/slim/slim/Slim/MiddlewareDispatcher.php(81): Psr\Http\Server\RequestHandlerInterface@anonymous->handle()
#19 /config/www/organizr/api/vendor/slim/slim/Slim/App.php(215): Slim\MiddlewareDispatcher->handle()
#20 /config/www/organizr/api/vendor/slim/slim/Slim/App.php(199): Slim\App->handle()
#21 /config/www/organizr/api/v2/index.php(151): Slim\App->run()
#22 {main}

Bypass :

adding environment variables like http_proxy, https_proxy doesn't help, php doesn't seem to be able to use that.
a solution, not clean, that I tested and which works, is the following addition :

 --- /config/www/organizr/api/vendor/rmccue/requests/library/Requests/Transport/cURL.php.old   
 +++ /config/www/organizr/api/vendor/rmccue/requests/library/Requests/Transport/cURL.php.new
 @@ -93,6 +93,7 @@
                 $curl          = curl_version();
                 $this->version = $curl['version_number'];
                 $this->handle  = curl_init();
 +               curl_setopt($this->handle, CURLOPT_PROXY, "http://MY_PROXY_IP:MY_PROXY_PORT");
 
                 curl_setopt($this->handle, CURLOPT_HEADER, false);
                 curl_setopt($this->handle, CURLOPT_RETURNTRANSFER, 1);

This is obviously not enough, you have to do something similar each time you try to retrieve something via php... I have the list of marketplaces, I can request a new theme, the interface tells me that it's recovered but it's not the case, the theme does not appear in the "Colors & Themes" menu

There may be something else to do that I haven't seen or understood.
If this is not the case, it would not be bad to add the management of "web proxy" flows in the settings.


Copy link

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant