matomo-for-wordpress icon indicating copy to clipboard operation
matomo-for-wordpress copied to clipboard

Failed to load resource: the server responded with a status of 502 (Bad Gateway)

Open dran007 opened this issue 3 years ago • 5 comments

Installed the matomo analytics 4.3.0 plugin on Azure web app, get the error below from the Reporting screen. Not able to load the stylesheets. Please advice.

whk8PV9kEn

Failed to load resource: the server responded with a status of 502 (Bad Gateway)

502 - Web server received an invalid response while acting as a gateway or proxy server. There is a problem with the page you are looking for, and it cannot be displayed. When the Web server (while acting as a gateway or proxy) contacted the upstream content server, it received an invalid response from the content server.

dran007 avatar May 26 '21 03:05 dran007

Hi @dran007 sorry about that. Is there any chance you could create a user for us on your WordPress? If so, could you create a user with the "Matomo Super User" role for [email protected]? This way we would be only able to access the Matomo part in your WordPress but nothing else.

Generally it sounds like some web server configuration issue. I know that some users use it on Azure without any issues but it may depend on the web server you are using. Any chance you are familiar with web servers @dran007 ?

tsteur avatar May 27 '21 03:05 tsteur

Yes. Thanks for the response. Not sure how can you help if I add you as a Matomo super user. I installed this plugin in another Wordpress hosted in Bluehost out side of Azure env, I didn't see this issue. Only see this issue on Azure web app env. I checked the chrome console on this page, seeing this returned. /wp-content/plugins/matomo/app/index.php?module=Proxy&action=getCss&cb=aaba7d0e8279316b5c71048666f70841 Request Method: GET Status Code: 502 Bad Gateway Remote Address: xx.xxx.xxx.xx:443

Somehow the proxy action failed to 'getCss&cb=aaba7d0e8279316b5c71048666f70841', the stylesheet.

dran007 avatar May 27 '21 13:05 dran007

Hi @dran007 could you maybe try and see if the file loads when you request only /wp-content/plugins/matomo/app/index.php?module=Proxy&action=getCss without the cb parameter?

Any chance you could check the web server logs if there is more information provided about this error?

tsteur avatar May 27 '21 20:05 tsteur

I have tried that, getting the same error. Check the web sever logs, saw many HTTP502.3 Bad Gateway response. Failed Requests by URI /wp-content/plugins/matomo/app/index.php

I also set this log in the config.ini.php, but didn't see the matomo.log file in the /matomo folder configured below.

[log] log_writers[] = "file" log_level = "WARN" logger_file_path = "home/site/wwwroot/wp-content/cache/matomo/matomo.log"

dran007 avatar May 28 '21 17:05 dran007

@dran007 Matomo for WordPress actually uses the WordPress WP_DEBUG logging and the log writers shouldn't be used. You could try and enable WP_DEBUG to check if anything gets logged: https://wordpress.org/support/article/debugging-in-wordpress/#wp_debug

It seems either PHP or the web server is timing out. I don't know if WordPress would log anything if PHP times out but may be worth trying.

Otherwise, if any possible, are you or a system administrator maybe able to increase the timeout limits in PHP and/or your web server?

tsteur avatar May 30 '21 22:05 tsteur

Hi @dran007

Do you still experiment this issue with the latest plugin release?

Kind regards

Mat

mattmary avatar Sep 13 '22 01:09 mattmary

Hi @dran007

Without any answer, I close this issue. Feel free to open a new one if you still encounter some issues with our plugin. Kind regards

Mat

mattmary avatar Sep 13 '22 01:09 mattmary