can't access to my admin ....
hi !
i using varnish 4.0 and Wordpress 4.1 i like your job it's awesome cache. but i have a problem to enter my admin area:
mywebsite.com/s-login
or another website:
mywebsite.com/tomer-login
he said : " You must log in to access the admin area. " and i am the admin , i don't how to fix that , before this Code of Default.vcl i was free access to my admin area without problem..
what i need to do to fix that ?
regards, Tomer
Hi, i default.vcl change :
# Did not cache the admin and login pages
if (req.url ~ "/wp-(login|admin)") {
return (pass);
}
By :
# Did not cache the admin and login pages
if (req.url ~ "/(s-login|tomer-login|wp-login|wp-admin)") {
return (pass);
}
You can remove wp-login and wp-admin if you don't use them. Regards.
wow you fast ! i tried that now but still same error
anf if i delete Cookies from Chrome browser and after that i try to connect to admin area, he said this error:
ERROR: Cookies are blocked or not supported by your browser. Cookies must be enabled to use WordPress.
Have you custom the file varnish4-wordpress ? I remember that I have similary error and I think these lines resolve it :
# Remove the wp-settings-1 cookie
set req.http.Cookie = regsuball(req.http.Cookie, "wp-settings-1=[^;]+(; )?", "");
# Remove the wp-settings-time-1 cookie
set req.http.Cookie = regsuball(req.http.Cookie, "wp-settings-time-1=[^;]+(; )?", "");
# Remove the wp test cookie
set req.http.Cookie = regsuball(req.http.Cookie, "wordpress_test_cookie=[^;]+(; )?", "");
I don't remember exactly which repair your problem but try to search all "cookie" occurence in varnish4-wordpress. =)
so just add this line to code?
yep, look at varnish4-wordpress ;) https://github.com/nicolargo/varnish-nginx-wordpress/blob/master/varnish/varnish4-wordpress Maybe anothers lines must be add, but there all in example file ;)
this exactly the code i copied ... and also i added this line into file right now ,and still error with cookies
by the way this:
Only allow purging from specific IPs
acl purge { "localhost"; "127.0.0.1"; }
i did not change the ip (127.0.0.1) this ok right ?
Sorry i haven't read all my file earlier. You must also ahve theses lines in sub vcl_backend_response :
# Only allow cookies to be set if we're in admin area
if (beresp.http.Set-Cookie && bereq.url !~ "^/wp-(login|admin)") {
unset beresp.http.Set-Cookie;
}
For your configuration you must change it to :
# Only allow cookies to be set if we're in admin area
if (beresp.http.Set-Cookie && bereq.url !~ "^/(s-login|tomer-login|wp-login|wp-admin)") {
unset beresp.http.Set-Cookie;
}
I hope your error is gone. 127.0.0.1 and localhost are right in almost ever case ;)
yes !!!!!! you did it !!!!
Great !
thank you so much
i think maybe you need to add this to your code .. i mean to add explain if someone (like me) change the login admin area..
It's in the file, but you must adapt it to correpond to your custom install. By default you can access wordpress admin with /wp-admin address. You modify it for use (s-login|tomer-login) so you must add this change in config file ;) Have a nice day.
thank you so much i like your code it make my Wordpress fastest
hi again.. i forgot to ask: i need also this plugin (or your code do that automaticlly ? LINK: https://wordpress.org/plugins/varnish-http-purge/
No, you had to use this plugin in order to purge the cache (for exemple after an WP plugins update).
SO the answer is not, right ?
Yes the answer is... not.
THANKS