php-proxy
php-proxy copied to clipboard
support a separate file for configuration settings
Thanks for this great script!
I don't like changing Proxy.php for settings, for example if I want to hardcode the TARGET_URL. See attached Pull Request.
Thanks for the pull request! 🙂 From what I see, the same could be achieved by calling this at your application startup (or anywhere before using the proxy):
Proxy::$AUTH_KEY = 'Bj5pnZEX6DkcG6Nz6AjDUT1bvcGRVhRaXDuKDX9CjsEs2';
Proxy::$ENABLE_AUTH = true;
Proxy::$DEBUG = false;
Proxy::$TARGET_URL = "";
The configuration variables are public static, thus you can change them anytime. Would that fit your use case?
In my usecase, I am using a htaccess like this:
RewriteEngine On
RewriteBase /
# no parameter
RewriteCond %{REQUEST_URI} ^/$
RewriteCond %{QUERY_STRING} ^$
RewriteRule . https://www.beispielverein.de/?test1 [R=302,L]
# avoid direct access to Proxy.php
RewriteCond %{REQUEST_URI} ^/Proxy.php$
RewriteRule . https://www.beispielverein.de/?test1 [R=302,L]
RewriteCond %{QUERY_STRING} !^page_id=[0-9]+&civiwp=CiviCRM&q=civicrm%2Fcontribute%2Ftransact.*$
RewriteCond %{QUERY_STRING} !^page_id=[0-9]+&civiwp=CiviCRM&q=civicrm%2Fajax%2Frest.*$
RewriteRule . - [R=403,L]
FallbackResource /Proxy.php
So Proxy.php is the fallback, and directly called. The goal is to prevent access to the CRM system, but only allow access to the public forms of the CRM system.
Ok, I understand now, I could set it all up with composer, and have an index.php instead, which uses Zounar\PHPProxy\Proxy
.