Skip to content
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

can't access to my admin .... #19

Open
TOMER628 opened this issue Jan 1, 2015 · 16 comments
Open

can't access to my admin .... #19

TOMER628 opened this issue Jan 1, 2015 · 16 comments

Comments

@TOMER628
Copy link

TOMER628 commented Jan 1, 2015

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

@Oyabi
Copy link
Contributor

Oyabi commented Jan 1, 2015

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.

@TOMER628
Copy link
Author

TOMER628 commented Jan 1, 2015

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.

@Oyabi
Copy link
Contributor

Oyabi commented Jan 2, 2015

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. =)

@TOMER628
Copy link
Author

TOMER628 commented Jan 2, 2015

so just add this line to code?

@Oyabi
Copy link
Contributor

Oyabi commented Jan 2, 2015

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 ;)

@TOMER628
Copy link
Author

TOMER628 commented Jan 2, 2015

this exactly the code i copied ...
and also i added this line into file right now ,and still error with cookies

@TOMER628
Copy link
Author

TOMER628 commented Jan 2, 2015

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 ?

@Oyabi
Copy link
Contributor

Oyabi commented Jan 2, 2015

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 ;)

@TOMER628
Copy link
Author

TOMER628 commented Jan 2, 2015

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..

@Oyabi
Copy link
Contributor

Oyabi commented Jan 2, 2015

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.

@TOMER628
Copy link
Author

TOMER628 commented Jan 2, 2015

thank you so much i like your code it make my Wordpress fastest

@TOMER628
Copy link
Author

TOMER628 commented Jan 2, 2015

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/

@nicolargo
Copy link
Owner

No, you had to use this plugin in order to purge the cache (for exemple after an WP plugins update).

@TOMER628
Copy link
Author

TOMER628 commented Jan 2, 2015

SO the answer is not, right ?

@nicolargo
Copy link
Owner

Yes the answer is... not.

@TOMER628
Copy link
Author

TOMER628 commented Jan 3, 2015

THANKS

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants