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

Grav in Nginx: 403 Forbidden, Oops invalid security token #1748

Closed
Sqoon opened this issue Dec 14, 2016 · 20 comments
Closed

Grav in Nginx: 403 Forbidden, Oops invalid security token #1748

Sqoon opened this issue Dec 14, 2016 · 20 comments
Labels
Milestone

Comments

@Sqoon
Copy link

Sqoon commented Dec 14, 2016

Hello, I recently manually installed Gantry onto Grav, Gantry themes work fine, although changing anything within the Appearance admin tabs yields a "403 Forbidden, Oops invalid security token".

I am not sure if I am overlooking something simple.
Any help would be much appreciated, thank you.

@w00fz
Copy link
Member

w00fz commented Dec 14, 2016

Are you running the latest grav and grav admin?

@Sqoon
Copy link
Author

Sqoon commented Dec 14, 2016

Yes, freshly installed and updated.

@w00fz
Copy link
Member

w00fz commented Dec 14, 2016

Hmmm, I cannot reproduce this issue. Have you tried clearing all cache and logging out and in again?

@kat05
Copy link

kat05 commented Dec 14, 2016

I am also not able to replicate the issue.

@hexplor
Copy link
Collaborator

hexplor commented Dec 14, 2016

been testing grav a lot recently, never experienced this issue :(

@Sqoon
Copy link
Author

Sqoon commented Dec 14, 2016

Still occurs after clearing cache and logging out.

It might have something to do with firewall or htaccess but I'm still super lost.
I'm using Ubuntu 16.

Maybe I need to set permissions somewhere, but again I'm still lost.

@w00fz
Copy link
Member

w00fz commented Dec 14, 2016

Can you let us know the steps you perform to get to the issue?

I'm assuming you go in admin, have Helium/Hydrogen enabled as themes, go in Appearance, make some changes like background colors and such, click Save and get the error. Is that correct?

@Sqoon
Copy link
Author

Sqoon commented Dec 14, 2016

That's correct. Anything I want to save or change in the appearance tab, just gives me a 403 error. So I basically can't change anything with the theme. It also gives me this error with other Gantry related themes.

@w00fz
Copy link
Member

w00fz commented Dec 14, 2016

Which other Gantry related themes?
Perhaps you can send me your site and admin account in private on https://gitter.im/w00fz

@mahagr
Copy link
Member

mahagr commented Dec 14, 2016

I've seen this issue happening many, many times before. Try disabling mod_security if it helps. Later you can re-enable it, but there are some rules (which I need to dig up) which need to be disabled.

@mahagr
Copy link
Member

mahagr commented Dec 14, 2016

Actually.. What does the error look like? Might be something else.

@Sqoon
Copy link
Author

Sqoon commented Dec 14, 2016

Well, W00fz helped me a bit, and I figured out that I might have Nginx configured incorrectly.

I'm going to take a day to reconfigure it, and I will report back tomorrow to see if everything was fixed correctly. Thank you all for the help.

I'll be back tomorrow and let everyone know if it gets fixed.

@mahagr
Copy link
Member

mahagr commented Dec 20, 2016

@Sqoon Did you manage to fix your issue?

@mahagr
Copy link
Member

mahagr commented Dec 23, 2016

We are not yet sure why this happens for some users. If possible, please join us in https://gitter.im/gantry/gantry5 so that I can look into your site.

@flaviocopes
Copy link

@mahagr
Copy link
Member

mahagr commented Jan 9, 2017

@Sqoon Above link may help you to fix the issue ^

@mahagr mahagr changed the title Grantry, Grav, 403 Forbidden Grav in Nginx: 403 Forbidden, Oops invalid security token Jan 12, 2017
@mahagr
Copy link
Member

mahagr commented Jan 13, 2017

Please update nginx.conf:

    location / {
        try_files $uri $uri/ /index.php?_url=$uri&$query_string;
    }

@mahagr mahagr closed this as completed Jan 13, 2017
@mahagr mahagr added this to the 5.4.3 milestone Jan 13, 2017
@beedzei
Copy link

beedzei commented Mar 3, 2017

I have updated nginx.conf with suggested location fix but still same 403 error - on the latest Grav + admin, Gantry 5 and Helium and all on 16.04

@beedzei
Copy link

beedzei commented Mar 4, 2017

PS. Solved - needed to be edited in sites-available/grav, not in main nginx.conf.

@samwalls
Copy link

samwalls commented Mar 13, 2017

And, in case you're using Caddy, the equivalent rewrite rule:

rewrite {
    to  {path} {path}/ /index.php?_url={uri}&{query}
}

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

No branches or pull requests

8 participants