Support » Plugin: Max Mega Menu » Can’t save menu, gets 504 Gateway Timeout error

  • Our menu isn’t that huge, it’s a few megas with some columns in them.

    I have our site behind a Sucuri firewall/proxy and I can’t save the menu because it ends up with a 504 Gateway Timeout error.

    After some troubleshooting with Sucuri, I found that they have a hard limit of 32kb for the header size of a request, and when saving a max mega menu, the header size is around 181kb which is HUGE!

    Even when I bypass Sucuri and use my local hosts file to connect directly to the SiteGround IP, I still end up timing out most times.

    I don’t know if there is any way to fix this or somehow reduce the size of the massive JSON payload in the header when a menu is saved, but something needs done so that both SiteGround and Sucuri can’t handle a header this size when saving the menu.

    How else can I get this menu to save?

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author megamenu

    (@megamenu)

    Hi guyinpv,

    I also use Sucuri, but haven’t run into this issue.

    Is it this button that is not working for you?

    https://screencast.com/t/X58QvmVvpO6z

    Regards,
    Tom

    Plugin Author megamenu

    (@megamenu)

    Hi guyinpv,

    I’ve been thinking about it and I’m pretty sure you are referring to that button.

    It is core WordPress that sends the save request as a huge JSON packet, please see this ticket:

    https://core.trac.wordpress.org/changeset/36510

    “The entire form is now JSON-encoded into a single input which populates $_POST manually on form submission.”

    We do not actually do anything when you click that ‘Save’ button, so you should see the same behaviour whether or not you have MMM enabled.

    Please see this page for some more information:

    https://www.megamenu.com/documentation/error-403-404-500-when-saving-menu/

    I also use SiteGround and do sometimes notice that saving the menu structure can be very slow, and then a few hours later it will be fine.

    Regards,
    Tom

    Thread Starter Guyinpv

    (@guyinpv)

    Yes, that’s the button, just the normal menu save button.

    I understand what you’re saying. So it’s WP that is saving the menu in this way. Though I’m sure using MMM makes for a larger payload surely? How does all the MMM data get saved, is it not in the same save event?

    Anyway, 32kb is not very large. If all this is true, this means that any host or proxy that doesn’t allow huge headers won’t even be able to save moderately big menus. Which is the situation I’m in.

    How do I get around this? I know it’s not really MMM fault but maybe someone has an idea.

    Plugin Author megamenu

    (@megamenu)

    Hi guyinpv,

    How does all the MMM data get saved, is it not in the same save event?

    All MMM data is saved in individual AJAX request(s) when you open the lightbox that contains the mega menu settings.

    I’m not sure how to get around it sorry, it sounds like a server config issue as I have a pretty much identical setup: Sucuri and SiteGround. I was thinking this morning though – I think the “huge” payload (i.e. the JSON string that represents the menu items/structure) would actually be in the body of the request, not the headers, so it may be worth going back to siteground and asking them to take another look.

    Regards,
    Tom

    Thread Starter Guyinpv

    (@guyinpv)

    I can’t say for sure, but back a few weeks ago when I was testing this, Sucuri used that language to define the problem. They called it headers. I suppose you’re right, that the JSON submission data should be in the body, or is it?

    Here’s a screenshot of the timeout.
    https://www.dropbox.com/s/xvar9r4dsrpguih/timeout.png?dl=0

    I realize this is not MMM fault, but it’s still a curious problem. I can’t just NOT have a large menu, that’s kind of the point of mega menus, to fit a lot of stuff!

    Apparently WP fixed the max input vars issue by doing the giant JSON payload idea, but then we just run into this problem. I don’t know how to fix it or get around it. I’m just stuck not being able to save my menu just because it’s kinda big?

    Plugin Author megamenu

    (@megamenu)

    Hi guy,

    You’re correct in your analysis.

    I would still go back to SiteGround and ask them to take another look. The demo menu structure on megamenu.com is pretty big and it does save OK. I also use SiteGround (one of the Cloud plans).

    Regards,
    Tom

    Plugin Author megamenu

    (@megamenu)

    Hi guy,

    I’ve just remembered a workaround – try editing your menu structure from Appearance > Customize instead. That uses a different save process to the nav-menus.php page. Then you can come back to the Appearance > Menus page to edit the mega menu settings for your menu items.

    Regards,
    Tom

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Can’t save menu, gets 504 Gateway Timeout error’ is closed to new replies.