getgrav / grav-plugin-admin

Grav Admin Plugin
http://getgrav.org
MIT License
355 stars 223 forks source link

Internal Server Error when saving #2271

Open jason-unleashed opened 2 years ago

jason-unleashed commented 2 years ago

I don't know if this is an Admin or Quark template problem but I'm going to start here.

Issue: when creating a new "Item" for my blog through Admin, sometimes upon save I get an "Internal Server Error". I can go back and my changes to the page are gone.

If I edit the "item.md" file directly there is no issue and the page displays correctly from a web browser.

It's not all "item.md" files. Just some.

For example, this markdown does not successfully save in Admin:

---
title: 'Does the 60/40 Asset-Allocation-Pie Make Sense?'
subtitle: 'No allocation can cure the ill effects of stampeding in and out of markets'
taxonomy:
    category:
        - articles
    tag:
        - Investing
media_order: 60-40-pie-investment-allocation.jpg
hero_classes: 'text-light title-h1h2 parallax overlay-dark-gradient'
feed:
    limit: 10
publish_date: '26-04-2022 07:00'
date: '26-04-2022 07:00'    
---

The magic asset allocation number so often touted is a 60/40 split between stocks and bonds. This is supposed to give you the growth potential of equities and the stability of fixed-income. Trouble is, that mix didn’t do so well over the past 10+ years.

Most likely the reason is that almost all equity classes benefited from a spectacular 10-year bull market run prior to COVID and then an amazing bounce-back after the COVID-induced market swoon. Layer on historically low interest rates for fixed-income securities and you can see the challenge.

None of this is to say that a stock-bond mix is a bad idea. It’s simply not a panacea.

### Pie-Investing 101

Today, it is easier than ever to own a broadly diversified stock/bond portfolio, often represented as a pie. You can buy blended 60/40 portfolios in the form of a mutual fund. Many have a broad range of both domestic and international stocks and bonds, for a rough breakdown of 60% equities and 40% bonds.

Over the past 10+ years, target-date pie funds became popular in 401(k) plans, where the stock/bond blend shifts toward bonds progressively as you age, until you reach a retirement target date.

The latest portfolio pie offerings are from robo-advisors who place a slick Internet user interface between the investor and the fund. The replacement of a human contact with a website is what warrants the word “robo.” For some investors, this gimmick creates a sensation of customized, technologically advanced wealth management. The number of investment pie offerings today nearly equals the number of pizza pie offerings in New York City.

But the investment pie approach is not particularly effective in avoiding major downside volatility, to say the least. It can also place a major drag on long-term investment performance.

### Simple & Disciplined

What about asset allocations other than 60/40? Well, there’s no elixir here, either. Sure there are lots of investment products that let you try different levels of risk: for conservative (30% stock), moderate (40%) and aggressive (70%) strategies, respectively. These investments have been around for a long time, but take a good look at their performance and risk characteristics before you invest.

While pie investing can deliver decent returns, it does have the benefits of being simple, disciplined and non-emotion-based. But if you’re not careful, the average-pie-investor can perform substantially less than the disciplined-pie-investor.

Why? Because too many of these investors made emotion-driven decisions at bad times. They bail out when the stock market tanks and get in after it rebounds. And re-entry can be expensive. Fear and greed often appear to dominate the investment allocation process, alas.

The truth is that no asset allocation, regardless of its breakdown, can cure the ill effects of unwise stampeding in and out of markets.

Give me a call to see what makes sense for you.
mahagr commented 2 years ago

Please check the logs after the error occures. It should tell what is going wrong.

jason-unleashed commented 2 years ago

I checked my Grav logs and there was no corresponding warning or error.

I was able to work around the error but it's not a solution. I found the section of the text that was creating the problem "... retirement target date."

For whatever reason, Grav admin does not like to end a line with "target date." I had to add two spaces to the end of the line and it seems to be ok.

mahagr commented 2 years ago

The issue sounds more like a firewall problem (mod_security in Apache or something similar) than an issue in Grav. They have often rules that blindly find words from the responses, like "select ... from ... where" and block every request containing those words in the body.

Please check your apache logs, they should have entries for blocked requests with the rule id.

jason-unleashed commented 2 years ago

I'll look for the apache logs.

This issue only happens when using Admin. If I open the file in a text editor there is no problem saving and the page displays correctly. In Admin, once I find the line that's causing problems I can successfully save by adding spaces at the end of the line.

It's happened on at least 3 of my recent blog posts in the last month. I have about 200 total pages that were created in previous versions of Grav over that last 5 years and that never happened before.

Feels like an admin issue.

mahagr commented 2 years ago

Yes, it still sounds a lot like mod_security issue. Check if you have it enabled.

I cannot think of any way where the content in the page would cause saving to fail, except maybe if you had some html, javascript, or twig in it (there is some code to check those). Also, I forgot to say that I have tried to save the above markdown file and it works just fine.