nginx getimagesize from local server: 403

Vincent M. mouseless at free.fr
Tue Aug 3 19:14:02 UTC 2021


Hello all,

I have a 403 error when trying to use the PHP function getimagesize on 
nginx based web server:

list($imageWidth, $imageHeight) = getimagesize($imagesSource['Main']);

Where $imageSource['Main'] is like:

https://mywebsite/include/php/render/canvas/VR/2/image/U35p/ver//bgColor/ffffff/widthMM/300/heightMM/388/aube-sunny.jpg

It's an image generated by PHP-imagick module and is not locally 
available. This image can be opened by a browser with no problem.

To generate this image which go through 404. Nginx is configured like that:

error_page 404 = /url_rewriting.php;
And in the file url_rewriting.php, we analyse the URL to see if it's 
real 404 or an image which must be generated:

if((isset($urlHash[2]) && $urlHash[2] === 'render')) {
...
     header('Status: 200 OK', false, 200);
     chdir('include/php/render/'.$_GET['render']);
     require ('include/php/render/'.$_GET['render'].'/render_img.php');
     exit;
}
All is working fine but not the getimagesize from my own server.

What is strange is that it's working fine on my development environment 
which has the same versions of nginx and PHP and pretty the same 
configuration.

It might a configuration issue or a right issue on a certain file but I 
don't know where to check.

Thank you,
Vincent.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20210803/85d99cc7/attachment.htm>


More information about the nginx mailing list