Azure hosted Wordpress site taking long to connect to domain - wordpress

I'm running a wordpress website on Azure with a MySQL DB both located in East US
However, for some reason recently the website has been taking a much longer time than usual to connect. The first request to connect to the domain takes 6+ seconds.
I've edited the Web config file and worked with a Cache for the website but its still giving me the long waiting times. Would Appreciate any help.
longwaitingtime

Related

Azure App Service - Wordpress super slow and cURL error 28

Following the announcement found here https://azure.github.io/AppService/2022/08/08/Announcing-GA-WordPress-on-Azure-App-Service.html
I've decided to migrate my website from a Ubuntu Server VM on Azure to this App Service configuration.
First, I've created new resources using the "Wordpress" template/configuration which I found on Azure portal. So, the deployment process created an App Service (plan P1), a MySQL database and a CDN Endpoint.
Everything seems to working quite fine. Then I've moved my website files from the VM to the App Service and I've created a new database in MySQL server where I've imported my website database without problems.
I've kept the wp-admin and wp-includes folders which were deployed by Azure and the wp-config.php file.
As final step, I've changed the configurations in the App Service to connect to the right database.
Then I tried to visit my website, but it is super slow (about 10 seconds to load the home page and I was forced to disable some plugins which was causing a fatal error).
I've checked the Wordpress Health Status using the plugin in the admin center, and it reports some issues.
Two of them are reporting a message like this:
cURL error 28: Resolving timed out
I've seen another post on SO ("cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux) with a similar issue and it suggested to change resolv.conf DNS to 8.8.8.8 (previously was 127.0.0.11). The author of the post wrote that this change improved page load time to max 1-2 seconds.
I've made this change but then the website stopped working returning "Error establishing a database connection" (maybe because MySQL db and app service are on the VNET created by Azure Wordpress template and there are some restriction to connect to database).
I've also tried to disable the CDN, changing the CDN_ENABLED to false in the App Service configuration. Obviously I've created the correct custom domains in the App Service and changed the domain DNS which is managed outside Azure.
Also, and I don't know if it is all related to this issue, I've noticed that Google Page Speed is unable to reach the website reporting the error "Lighthouse encountered an error loading the requested page".
What can I do to resolve the reported cURL error 28 and maybe these performance issues?

IIS 10.0 http 500 error reading .txt after kb5001402 and 1347

We have 3 ASP.NET 4.5 websites set up in IIS 10.0, windows 2016, all on port 443 using Host Headers to direct to correct site. The sites are on 2 servers with an NLB in front, the NLB pings each site looking for a status.txt at the root of each site folder to know if the site is active.
After the windows updates kb5001402 and 1347 on april 27th, the NLB can no longer read the status.txt files, IIS is returning a http 500 error. There is nothing in the event logs or the IIS logs except the http 500.
I'm at a bit of a loss where to look next or how to fix this, any thoughts or ideas?
Additional Info: To narrow things down, I turned off the second server removed all the sites but one and removed the host header, so now I have one site on one server on port 443. Using the server name to bypass the NLB I can access .aspx pages, but the .txt and .png files do not load. So for some reason IIS will not serve the .txt or .png after the patches
Edit and Answer - It turned out the service account the app pool was running under had been removed from the required "permission" set of the certificate the site was running under. No idea how this happen or if was even related to the kb.
Those KBs have been installed this morning on my system and I had a similar issue in an app where PNGs were not displaying anymore.
In my case, it turned to be a security problem: A website running with anonymous authentication under the App Pool identity. And, this morning, the authentication was set to IUSR. Which led to the PNG not being shown (due to access being denied, I suppose). After setting authentication back to 'app pool identity', the problem was solved.
I didn't find anything in the KB which can explain this. I presume that the txt file should be 'anonymous' to be read from a NLB.
Have you already checked that nothing has changed around the authentication on you system?

ASP.Net redirecting to local host after authentication

I just created a webform that is hosted in my Azure subscription. I set it up with authenication via my works Azure directory for authenticating users. In debug this works fine and I am able to login with my work credentials and then view the website via local host.
I have published this to my Azure and it says it is running and working fine. So when I try to connect to the website it continuously redirects me to the localhost resulting in an error.
I have checked the web config.
Here is the google network chain of events when it occurs.
I am really lost as to what is wrong and what I need to do to fix this so any help would be greatly appreciated. I'm sorry I can't offer more but I don't even know what is wrong to begin with or where to look. Is there some setting in Azure that I need to add the website too?
I have solved this issue. Since it was such a pain I will keep this up as I couldn't find any answers on this. It was actually quite simple.
You have two options. The one I did and which worked was changing the publish profile as below:
Add the domain where the authentication is occurring. So if you have your web app hosted by a different azure account that which is authenticating the users, use the one that is authenticating.
This will create two versions of your app on the site one for local host and one for the actual site.
The second option(I have not tried this but it should work) is to go to the Azure account where you are authenticating the users and go to applications and then configure. Change the APP URL from local host to the url you are trying to get to.
Here is an excellent link that explains how to do this clearly.
Click this link for detailed explanation
I also had this issue and took these steps to resolve
navigate to the app registration in AAD
Open the manifest
Change the ReplyUrl to the url of the app (e.g. http://appname.azurewebsites.net)
Then I got the error
Bad Request - Request Too Long HTTP Error 400. The size of the request headers is too long.
Next I cleared all cookies from the browser, and this changed the error to just
Bad Request
So I went back to that ReplyUrl and changed it to https://appname.azurewebsites.net/.auth/login/aad/callback and now it appears to work.
Note I also had to make sure I didn't have the site open in any other tabs before it started working
I had this issue when I switched an app from our company Azure over to a customer's Azure. In my case I'd forgotten to update the ida:ClientId, ida:AADInstance and ida:TenantId, which then meant that the value I'd set for ida:PostLogoutRedirectUri was ignored (I think) and instead my app redirected to localhost.
Once I changed those ida values to the values from the app settings and subscriptions settings on our customer's Azure it all worked as expected.
It took a while to track down all the values in Azure portal as they are all called something different, or aren't named at all:
ClientId can be found at Azure Active Directory > App Registrations > YourAppName. It's called 'Application ID' in Azure
Domain can be found on Azure Active Directory > Overview. It's currently in the top left in the format somename.onmicrosoft.com
TenantId this is the Azure AD instance ID, get that from Azure Active Directory > Properties and then it's called 'Directory ID'
I spent a lot of time trying to work out where the localhost port that was being redirected to was in the code, but it simply isn't there as far as I can see, so I have no idea how Azure was choosing what localhost address to redirect to!
You need to set another parameter in configuration that is replyUrl and assign to your web app, other wise it takes the url from which it was originated.
I was able to fix this by changing my Startup.Auth.cs file redirectUri from "https://localhost:44316/" to https://myapp.com/

Strange IIS behaviour where server responses are being cached

We've a website running since 5 years ago with no problems. A few days ago, users called support, telling they were not able to log into the website. We restarted our servers and all started working properly.
Today we have a product description that was edited (and is correct in our database) but the website won't display the updated value, it keeps displaying the old one.
All these values are retrieved via AJAX and POST method. I was able to see in my chrome Network tab how the server was sending the old response (outdated product description).
I restarted the SQL server, restarted the IIS (from the play button in IIS manager). No luck.
After that I restarted a service called "IIS World Wide Web Publishing Service (W3SVC)" and after that, magically, all started working properly.
The only important change we did (afaik) to our server after all these years, which was done 1 month ago, was to enable the compression module for dynamic content.
Now, another user is telling us about another value not being updated after it was edited.
What's going on and why after we restart that process all starts working?

Session timeout after some seconds in Umbraco

I have created an site on Umbraco 7.1.6 it was working perfect in Visual studio 2012; when I deployed it to my hosting space I found a problem that it redirects me to login screen again and again just after some seconds. I have set keep user login to true and increased timeout but no improvement.
When I searched for that problem I found some links:
https://github.com/umbraco/Umbraco-CMS/compare/release-7.1.6...7.2.0
http://issues.umbraco.org/issue/U4-3845
https://github.com/Umbraco/Umbraco-CMS/commit/c936aaa51753862914591b753f7f2d7be7749cf7
First link provide me file but I do not know how to updated my current site.
In console I am getting an error.
GET http://example.com/umbraco/backoffice/UmbracoApi/Authentication/GetRemainingTimeoutSeconds 401 (Unauthorized) angular.min.js:106(anonymous function) angular.min.js:106o angular.min.js:102g angular.min.js:100i angular.min.js:79i angular.min.js:79(anonymous function) angular.min.js:80e.$eval angular.min.js:92e.$digest angular.min.js:90e.$apply angular.min.js:92safeApply umbraco.services.js:58(anonymous function) umbraco.services.js:6773(anonymous function) angular.min.js:108e angular.min.js:31(anonymous function)
I just experienced the exact same symptoms. A site ran just fine locally, using IIS Express, worked fine when deployed to Azure WebSites, but when I ran on a Windows Shared Hosting environment, the back office session would timeout somewhere between a couple seconds and a couple minutes.
I'd get a pop-up authentication window often but not always on the GetRemainingTimeoutSeconds url.
I filed a ticket, and the provider was able to replicate the issue. They said the site was running in full trust.
After enabling 32 bit application support - the issue is resolved.
Thanks to everyone, especially to #Morten Oc who commented.
It's properly something on the hosting. Have you tried other Umbraco installations on hosterpk? Also, try to set the login time (in webconfig) to 0.
I found out a solution that it was due to hosting environment (permissions), I deployed on client's hosting and it works perfectly.
Additionally if you do not have full trust hosting then it would not be able to maintain its session, you would have to configure session to managed in database.
For more info how to configure please refer to this post:
https://www.saotn.org/configure-sqlserver-sessionstate-for-umbraco/

Resources