-
Notifications
You must be signed in to change notification settings - Fork 118
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Each Request creates new static file #79
Comments
Got this too, anybody got the solution? |
Hi I seems to solve mine. I have to place the apache mod_rewrite at root but for mine, I need to add /public in the rewrite rule & condition, so it become below: Serve Cached Page If Available...RewriteCond %{REQUEST_URI} ^/?$ |
Can you please come to me at TG @Laptic |
I did the same, it creates the cached file again and again even no update in page |
Does your route or parameters contain any non latin character or space that will produce % sign when urldecoded? eg: having space in your route name or parameters will produce %20, then will cause the .htaccess rule not be able to find the cache file then re-cache it again. The same go to non-latin language in URL. I'm using Thai so I also face the same problem. Good news is, I have figured out the solution by inserting urldecode() in original cache method. Here is how I did it:
so your whole cache function should now look like this:
Hope this helps. Also some tips to test if cache is working, you can see significant decrease in request time. But there are more complicated way I also use by playing around with .htaccess in order to solve my problem. This library itself is very simple, I think you are facing the same problem as mine (% sign). Hope applying above code would be able to fix yours. |
Requesting, if you can help,
Above Tried but still issue.
…On Sat, 26 Jun 2021, 09:49 champkris, ***@***.***> wrote:
Does your route or parameters contain any non latin character or space
that will produce % sign when urldecoded? I faced the same problem. Solve
it by inserting urldecode() in original cache method.
Here is how I do it:
1. go to Silber/page-cache/src/Cache.php
2. in public function cache, just add this line before
$this->files->makeDirectory($path, 0775, true, true);
$path=urldecode($path);
$file=urldecode($file);
so your whole cache function should now look like this:
public function cache(Request $request, Response $response)
{
list($path, $file) = $this->getDirectoryAndFileNames($request, $response);
$path=urldecode($path);
$file=urldecode($file);
$this->files->makeDirectory($path, 0775, true, true);
$this->files->put(
$this->join([$path, $file]),
$response->getContent(),
true
);
}
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#79 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ALPODMT5UXL6CT2W62MUB4DTUVIOHANCNFSM4632FR2A>
.
|
After deeply reviewing, I came to find that even if the page has got no change, it keeps updating the cached static html file. (As i see the time of the file)
That is the reason I cannot request the cached page, since it keeps updating.
Please help
The text was updated successfully, but these errors were encountered: