maelep Posted December 19, 2020 Posted December 19, 2020 Hello, I need to access Apache configuration because I have an issue with a CMS: "the latter could be due to your web server not passing the authorization header to PHP, which might happen when using Apache & PHP FPM". He said that a simple setting can change this. How can I access Apache config?
Seekier Posted December 19, 2020 Posted December 19, 2020 He said that a simple setting can change this. How can I access Apache config?I think you'll need a VPS to do that 1
wolstech Posted December 19, 2020 Posted December 19, 2020 You can't. You're on a shared server, which means the Apache installation is used for thousands of websites, not just yours. If we allowed users access to it, your changes would affect everybody, and quite likely break other users. That said, we might be able to make the needed changes for you if they won't break anything (if they break something, you would need to buy a VPS so you have an entire server to yourself). What software are you trying to use, and what isn't working?
maelep Posted December 19, 2020 Author Posted December 19, 2020 (edited) You can't. You're on a shared server, which means the Apache installation is used for thousands of websites, not just yours. If we allowed users access to it, your changes would affect everybody, and quite likely break other users. That said, we might be able to make the needed changes for you if they won't break anything (if they break something, you would need to buy a VPS so you have an entire server to yourself). What software are you trying to use, and what isn't working? I'm using a simple website CMS, you can see it at https://rust.maelep.be and this one comes with a Rust's game plugin that link my website to my game server. Players who buy a package on my website will make my website send a command to my game server that will grant the package. To make it works, I have to "sync" the plugin to my website but it doesn't seems to be possible to do that with changing a parameter in Apache. (I'm noob at this, I don't know the parameter). The CMS is Ember from https://www.gmodstore.com/market/view/5620 (PAID)The plugin is https://umod.org/plugins/ember (FREE) Plugins use CSharp web request, it was working with my old web host (https://www.easyhost.be/en/) and it isn't a VPS so I supposed that changing the parameter needed will break anything. I'm discussing with the developer of Ember and he said: the issue is the Authorization header isn't being passed to Apache (presumably, given the token & host in your plugin configuration are correct)pretty much the same issue as this one herehttps://support.deskpro.com/en/kb/articles/missing-authorization-headers-with-apache Edited December 19, 2020 by maelep
wolstech Posted December 19, 2020 Posted December 19, 2020 Lets see what Krydos says about this. He's the one who would need to fix this.
Krydos Posted December 20, 2020 Posted December 20, 2020 That's not much information to go on. How about the exact error message perhaps?
maelep Posted December 20, 2020 Author Posted December 20, 2020 (edited) That's not much information to go on. How about the exact error message perhaps?The error comes from the plugin and it's a customized one ("Unauthorized") but the code code source of the plugin is: Puts ("Checking connection to server"); config.Token = "myPrivateToken" config.Host = "https://rust.maelep.be" headers = new Dictionary<string, string> { { "Authorization", "Bearer " + config.Token }, { "Accept", "application/json" } }; webrequest.Enqueue (config.Host + "/api/server/connectioncheck", null, (code, response) => { if (code != 200 || response == null) { Puts ($"Connection failed. Response: {response}"); return; } Puts ("Connection established and token validated successfully"); }, this, RequestMethod.GET, headers); if (config.PollingInterval > 0) { timer.Every (config.PollingInterval, () => { PollUsers (); }); } And the source code of "connectioncheck" of the CMS is too hard to find but I found some files that can probably help you. I sent you it in private. An answer from the developer:routes are mapped to controller methods & middleware in app/routes.php. The relevant code is in ServerTokenMiddleware. The error is thrown if a PSR-7 getHeader call doesn't return any results so the issue is quite simply the Authorization header not being present in the request sent to PHP Edited December 20, 2020 by maelep
maelep Posted December 28, 2020 Author Posted December 28, 2020 (edited) Which version of php are you using?The default one of your hosting, it's 7.4 I think. A friend use HexaneNetworks host and it's working. Edited December 28, 2020 by maelep
Krydos Posted December 29, 2020 Posted December 29, 2020 We don't even offer php 7.4 yet on any of our servers. It's kind of important to know which version of php you're using because it would be a waste of time and pointless to change settings on a php version you aren't even using. You can check your php version by placing a phpinfo() file and opening it in your browser.
maelep Posted December 30, 2020 Author Posted December 30, 2020 We don't even offer php 7.4 yet on any of our servers. It's kind of important to know which version of php you're using because it would be a waste of time and pointless to change settings on a php version you aren't even using. You can check your php version by placing a phpinfo() file and opening it in your browser.It's 7.3.14: https://prnt.sc/wd00i6Ember requirements: https://prnt.sc/wd00vu
Krydos Posted January 1, 2021 Posted January 1, 2021 Ok, after a bit of research for you I think this is the line you need SetEnvIf Authorization "(.*)" HTTP_AUTHORIZATION=$1 I found that line here https://ember-docs.kekalainen.me/installation/web.html#web-server-configuration The SetEnvIf directive is available for use in .htaccess https://httpd.apache.org/docs/2.4/mod/mod_setenvif.html#setenvif So try putting that line in your .htaccess file and see if it works.
maelep Posted January 4, 2021 Author Posted January 4, 2021 Ok, after a bit of research for you I think this is the line you need SetEnvIf Authorization "(.*)" HTTP_AUTHORIZATION=$1 I found that line here https://ember-docs.kekalainen.me/installation/web.html#web-server-configuration The SetEnvIf directive is available for use in .htaccess https://httpd.apache.org/docs/2.4/mod/mod_setenvif.html#setenvif So try putting that line in your .htaccess file and see if it works. I already added that, it in htaccess that comes with Ember. RewriteEngine On RewriteBase / RewriteCond %{REQUEST_URI} ^/([^.]+)\.(png|jpg|gif|css|js|otf|ico) [NC] RewriteCond %{REQUEST_URI} !public/ RewriteRule (.*) public/$1 [L] RewriteCond %{REQUEST_URI} !public/ RewriteRule ^ public/index.php [QSA,L] SetEnvIf Authorization "(.*)" HTTP_AUTHORIZATION=$1 DirectorySlash Off
Recommended Posts