Hello everyone,
I’m trying to access an instance of ojs cloned from a production server, but when I try to access the base address I’m getting a 400 Bad Request error.
I’m using version 3.3.0-10 of ojs. Could someone give me a way?
Thanks,
Marcelo
Hello @Marcelo_Zoel,
In the case of errors such as these (400 or 500) it is best to check your PHP error logs - are you able to do that and report back? If unsure of how to check your PHP error log, please see this post here: How do I find my PHP error log?
-Roger
PKP Team
Hi @Marcelo_Zoel,
Check the allowed_hosts
setting in your config.inc.php
.
Regards,
Alec Smecher
Public Knowledge Project Team
Hi Roger, thanks for the tip,
Strangely, the PHP log is not recording any errors, despite the configuration in php.ini being error_reporting = E_ALL, is recording only service start and stop.
07-Jan-2025 13:54:37] NOTICE: fpm is running, pid 85845
[07-Jan-2025 13:54:37] NOTICE: ready to handle connections
[07-Jan-2025 13:54:37] NOTICE: systemd monitor interval set to 10000ms
[07-Jan-2025 13:59:05] NOTICE: Terminating …
[07-Jan-2025 13:59:05] NOTICE: exiting, bye-bye!
Since this is a homologation server, I activated display_errors to display the errors on the screen and there was no record either.
Hi Alec, thanks for the reply.
The value of the allowed_host variable is as follows:
allowed_hosts = ‘[“jgsbh.sgb.local”, “10.200.0.87”, “localhost”, “127.0.0.1”]’
where jgsbh.sgb.local is the canonical name of the service (as defined in the apache’s vhost, not the server hostname*) and 10.200.0.87 is the respective IP of the server where ojs runs.
Do you have any tips for trying to debug this problem?
- I also tried as the server name without success.
Hi @Marcelo_Zoel,
Looking at the screenshot, the fact that even the request for favicon.ico
came back as a 400 Bad Request
suggests that you’ve got a web server misconfiguration. favicon.ico
is a file, and so the request doesn’t even go through the OJS code.
Regards,
Alec Smecher
Public Knowledge Project Team
Hi Alec, following your line of reasoning, I took a look at the configuration of the vhost associated with ojs and disabled the RewriteEngine that was configured:
RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.*)$ index.php/$1 [QSA,L]From then on, I was able to perform the query normally. Now, I don’t know why this same behavior doesn’t occur on the production server since it has the same configuration.
Since the problem is not specifically related to ojs, I consider this ticket as resolved and I want to thank the colleagues who spent their precious time helping to resolve this issue.
See you next time, everyone.