Strange Behavior in Admin Config


#1

Hey all,

In Grav Admin -> Configuration -> Site … I get a blank page.

This makes sense because the save location says: /user/config/config.yaml

This file doesn’t exist, I’m fairly sure it never existed, shouldn’t it be looking for site.yaml?

I’m not sure when this started happening as I haven’t visited that admin section in ages. I’m assuming it happened in a version update.

Any insights?


#2

Hi,

https://learn.getgrav.org/basics/grav-configuration

System Configuration

Grav focuses on making things as easy as possible for the user, and the same goes for configuration. Grav comes with some sensible default options, and these are contained in a file that resides in the system/config/system.yaml file.

However, you should never change this file , instead any configuration changes you need to make should be stored in a file called user/config/system.yaml . Any setting in this file with the same structure and naming will override the setting provided in the default system configuration file.

This file “/user/config/config.yaml” is the basis of Grav configuration without it you are blank.

frrtls
Best regard
rtgm = read the Grav manual/documentation


#3

I appreciate the reply, however I’m not sure what you mean by “you are blank”?

Also you seem to be quoting part of the docs about a different file? I didn’t mention system.yaml in my post, I don’t see why you think it’s related? Please clarify.

This Grav installation has been running for about a year. It’s not a new installation.

Previously Admin -> Configuration -> Site was not blank. This is the only thing in admin (including the other config tabs) which is blank.

There have been no changes to the file structure or locations where .yaml files are concerned.


#4

If no one has any insight, I’d happily take the location of the code that determines what file to load from/save to in Admin -> Configuration -> Site and which generates the “Save location: /user/config/config.yaml” message.

It would be so much easier to hear from someone that has spent time in the Grav code, rather than having to deconstruct it from scratch. Come on Grav community, prove there’s a Grav community! :slight_smile:


#5

Ok, no problem Sorry,

/user/config/config.yaml thus not exist you are correct.

search in https://github.com/getgrav?utf8=✓&q=config.yaml&type=&language=

no file found.

I thit see your point. And thanks welcome me to the community.

Before you upgrade the next time try to make a backup of your code, test it before in a test environment.

frttls

Best regards


#6

Alright… returning to the problem…


#7

I feel like I’m shouting into the void here, an email to Grav support got no reply.

Is Grav dead?


#8

Grav isn’t, the support mail address may be – I never heard of Grav having an address for that.

The file does not insist, indeed – Grav has no such file – and you should be directed to a variation of http://grav.local/admin/config/site within Admin. What is the likely case, is that the server-config has changed – meaning .htaccess, Nginx-config, Caddy-config, or the like.

To debug, could you check the following?

  1. What version of Grav and Admin are you using?
  2. Does the Admin-dashboard still open from domain.tld/admin?
  3. Can you make a backup of the user-folder, and apply it to a fresh, local installation of Grav + Admin? If so, does the problem persist there?

#9

Well not support, the contact email on the website.

There have been no changes to the Grav installation recently besides theme installations and version updates (via admin).

Server config hasn’t changed outside of patches and other routine updates (I administer the server), .htaccess hasn’t changed, however the site was moved to a different domain maybe 6 months ago.

What leads you to believe the server config or .htaccess could cause grav to try to load the wrong .yaml file? Any insight into what’s going on would be helpful to me.

  1. Current version of Grav and Admin.

  2. Yes

  3. I will try this when I get a minute.


#10
  1. I copied the live site /user directory to a fresh local installation, everything worked fine.

So I downloaded the full grav+admin zip and uploaded it to the live site (except the user directory). Problem is still happening.


#11

Ok, that confirms that it is the live server where the problem lies. What type of server is it?

My suspicion of .htaccess or the like is that configuration in there is what makes Grav’s routing work on the relevant system. If the server does not follow those instructions, or they are mishandled, a variety of odd rewrites can occur.


#12

Apache… You were right, the source was (sort of) .htaccess.

Specifically:
RewriteCond %{REQUEST_URI} !^/site/
RewriteRule ^(.*)$ /site/$1

Which of course allows the site to load from root despite Grav being located in the /site/ subdirectory.

Interestingly this rewrite has been there since the site was launched, though the problem hasn’t.

Also, because it only applies to /site/ at the beginning of the URI it would ignore the word site anywhere else, and definitely wouldn’t have the capability to rewrite ‘site’ to ‘config’ (the word config is not present in any .htaccess in the directory tree).

I confirmed this by changing the redirect to a 301 so I could see what it’s doing.

So I guess this is now an edge case bug report :slight_smile:

Anyway, now that I know what’s causing it, I can work around it. Thanks for your help!