render() times out after 60 seconds with 503 - Service Temporarily Unavailable - cakephp

This code times out in a CakePHP 4.3.3 template with a
503 - Service Temporarily Unavailable.
In a none-CakePHP script it works [it shows after 6 minutes DONE].
ini_set("max_execution_time", "0");
sleep(360);
die("DONE");
The template is called like this:
$this->render("/General/index", "Study");
I didn't find anything regarding a max execution time for rendering but as I can clearly reduce it to the above MCVE, it must be something CakePHP relevant because in CakePHP it stops after 60 seconds, in a PHP file timeout.php, placed directly in the webroot directory, it works.
What am I doing wrong, what I haven't set up properly?
I think, I should present the log entry:
[proxy_fcgi:error] [pid 1813:tid 140621247407872] (70007)The timeout
specified has expired: [client XXXX:56968] AH01075: Error dispatching
request to :
The server is running under Apache/nginx.

I don't understand why a stand-alone script on the same server and same domain works, but under CakePHP it ran into the timeout - with the exactly identical 3 lines of code.
The solution was - after investigating the log error - the Apache2 Timeout.
Additionally, I had to set the nginx timeout settings:
proxy_connect_timeout 3600s;
proxy_send_timeout 3600s;
proxy_read_timeout 3600s;
fastcgi_send_timeout 3600s;
fastcgi_read_timeout 3600s;
After applying the above settings for Apache and nginx it works also under CakePHP.

Related

Varnish with Apache2 using mod_ssl and mod_proxy causing issues

I have installed the Varnish with Apach2 and setup that using the HTTP proxy apache module and used the headers to get the Data over HTTP and send it to HTTPS using reverse proxy.
ProxyPreserveHost On
ProxyPass / http://127.0.0.1:80/
ProxyPassReverse / http://127.0.0.1:80/
RequestHeader set X-Forwarded-Port “443”
RequestHeader set X-Forwarded-Proto “https
But the issue I am facing this setup is the Browser error Content is loading from HTTP over HTTPS has been blocked.
Mixed Content: The page at '' was loaded over HTTPS, but
requested an insecure stylesheet ''. This request has been
blocked; the content must be served over HTTPS.
Please help to understand where I am wrong and how can I make this work?
Thank you in Advance.
There's not a whole lot of context about the setup and the configuration, but based on the information you provided I'm going to assume you're using Apache to first terminate the TLS connection and then forward that traffic to Varnish.
I'm also assuming Apache is also configured as the backend in Varnish listening on a port like 8080 whereas Varnish is on 80 and the HTTPS Apache vhost is on 443.
Vary header
The one thing that might be missing in your setup is a cache variation based on the X-Forwarded-Proto header.
I would advise you to set that cache variation using the following configuration:
Header append Vary: X-Forwarded-Proto
This uses mod_headers and can either be set in your .htaccess file or your vhost configuration.
It should allow Varnish to be aware of the variations based on the Vary: X-Forwarded-Proto header and store a version for HTTP and one for HTTPS.
This will prevent HTTP content being stored when HTTPS content is requested and vice versa.
A good way to simulate the issue
If you want to make sure the issue behaves as I'm expecting it to, please perform a test using the following steps:
Clear your cache through sudo varnishadm ban obj.status "!=" 0
Run varnishlog -g request -q "ReqUrl eq '/'" to filter logs for the. homepage
Call the HTTP version of the homepage and ensure its stored in the cache
Capture the log output for this transaction and store it somewhere
Call that same page over HTTPS and check whether or not the mixed content errors occur
Capture the log output for this transaction and store it somewhere
Then fix the issue through the Vary: X-Forwarded-Proto header and try the testcase again.
In case of problems, just add the 2 log transactions to your question (1 for the miss, 1 for the hit) and I'll examine it for you

Cross-Origin Request Blocked: Authentication issue

ABP version 4.4 APP with identity server with angular EF core
my angular client send the username and password to identity server that is part of my abp application (mean same URL for api and identity server) that returns me token but after very next request for "api/abp/application-configuration" return with CORs error.
same application work for QA local environment with local config.
same call for "api/abp/application-configuration" work on app start because that time token is not attached in request header
i check my app setting CorsOrigins are matching with IdentityServerClientCorsOrigins
no space issue both angular and front end on https but with different port. you can verify with logs. one thing is strange in log no protocol attach # respond. (domain:1000)
I check and confirm that this is Authentication issue. by comment these two line and Authorize attribute from class
My application works fine. no issue for cors
app.UseAuthentication();
app.UseJwtTokenMiddleware();
system log
2021-09-04 10:42:24.731 -04:00 [INF] Request starting HTTP/2 OPTIONS https://domain:1000/.well-known/openid-configuration - -
2021-09-04 10:42:24.745 -04:00 [INF] CORS policy execution successful.
2021-09-04 10:42:24.751 -04:00 [INF] Request finished HTTP/2 OPTIONS https://domain:1000/.well-known/openid-configuration - - - 204 - - 19.7919ms
2021-09-04 10:42:24.793 -04:00 [INF] Request starting HTTP/2 GET https://domain:1000/.well-known/openid-configuration - -
2021-09-04 10:42:24.794 -04:00 [INF] CORS policy execution successful.
2021-09-04 10:42:46.050 -04:00 [ERR] Exception occurred while processing message.
System.InvalidOperationException: IDX20803: Unable to obtain configuration from: 'System.String'.
System.IO.IOException: IDX20804: Unable to retrieve document from: 'System.String'.
System.Net.Http.HttpRequestException: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. (domain:1000)
System.Net.Sockets.SocketException (10060): A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.
It is not a CORS issue, instead it is because your API (the UseJwtTokenMiddleware part) can't reach your IdentityServer over HTTP(s). I guess you got some DNS/Certificate/Network issue to resolve.

What is the reason of below error in vespa.ai?

We are facing this below error in Vespa, after restarting the cluster we got this below issue.
1600455444.680758 10.10.000.00 1030/1 container Container.com.yahoo.filedistribution.fileacquirer.FileAcquirerImpl info Retrying waitFor for file 'e0ce64d459828eb0': 103 -- Request timed out after 60.0 seconds.
1600455446.819853 10.10.000.00 32752/146 configproxy configproxy.com.yahoo.vespa.filedistribution.FileReferenceDownloader info Request failed. Req: request filedistribution.serveFile(e0ce64d459828eb0,0)\nSpec: tcp/10.10.000.00:19070, error code: 103, set error for connection and use another for next request
We faced this issue second time, earlier we kept it ideal and it was resolved automatically, but this time it is persistent.
Looks like the configproxy is unable to talk to the config server (which is listening to port 19070 on the same host: Spec: tcp/10.10.000.00:19070). Is the config server really runnning and listening on port 19070 on this host? Try running the vespa-config-status script to see if all is well with the config system

Laravel 5.2 - Getting 500 error when connecting with CSRF disabled

I am having an issue where I'm getting a 500 internal error when connecting to my Laravel API.
I had my site originally on GoDaddy using example.com as the main site and api.example.com as the api, but then decided to move it to Google Cloud Platform. I went ahead and set up an instance in the Google Compute Engine using Debian 8. I am using ISPConfig 3 to do all my server stuff. I have my site and my api in two separate repos on Github. I went my server directory to /var/www/example.com/web and cloned my main site into it. Since this create a folder within the root directory of my site, I also went into the vhost and set the default directory to point to the new cloned directory.
I then created another site with ISPConfig for my api and went into the DNS and created a A record and pointed it to the same IP as my main site. I then went into /var/www/api.example.com/web and cloned my api's repo into it, just like my main site. I went into the vhost for my api and pointed the default directory to my new cloned directory.
I can go to example.com just fine, but when I try to log in (this is the first point an api call is made), I get a 500 internal error.
I'm not using CORS and I never have because I use my own JSON web tokens, therefore my CORS is turned off.
Any ideas on how to fix the 500 error?
EDIT
Formatting
Edit 2
These are the last two lines in the error log for apache:
[Sat Sep 24 21:17:17.095798 2016] [core:crit] [pid 17588] (13)Permission denied: AH00529: /var/www/api.example.com/web/api/public/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable
[Sat Sep 24 21:17:17.095875 2016] [authz_core:error] [pid 17588] AH01630: client denied by server configuration: /var/www/api.example.com/web/error/403.html, referer: http://example.com/login
I'm not sure why it's throwing this .htaccess error. It's the .htaccess that Laravel automatically created.
Errors says what is your problem: Permission denied: AH00529: /var/www/api.example.com/web/api/public/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable
Make htaccess readable using chmod command:
chmod 644 /var/www/api.example.com/web/api/public/.htaccess
Also check this answers if this not help

solr admin panel HTTP ERROR 404

Am using digitalocean VPS I installed solr-5.5.0
sudo service solr status
Found 1 Solr nodes:
Solr process 1072 running on port 8983
{
"solr_home":"/var/solr/data/",
"version":"5.2.1 1684708 - shalin - 2015-06-10 23:20:13",
"startTime":"2016-02-25T17:14:47.47Z",
"uptime":"0 days, 8 hours, 39 minutes, 54 seconds",
"memory":"92.1 MB (%18.8) of 490.7 MB"}
http://myip:8983/solr/
am getting this error on my screen.
HTTP ERROR 404
Problem accessing /solr/. Reason:
Not Found
Powered by Jetty://
how to fix this error
As the exception says, you are missing the solrconfig.xml file in the conf folder of your core.
To get this file and all others, go to {SOLR_DIST}/server/solr/configsets/basic_configs and copy over the conf folder to /var/solr/data/gettingstarted1 and restart solr.
This will fix the error.

Resources