• Resolved Stefano

    (@stefacchio)


    Good morning,
    when I enable the plugin, ajax requests via WP REST API do not work, because the plugin cuts off the string /wp-json/ in the url.
    It should be https://domain.com/wp-json/wp2/…. instead it is https://domain.com/wp2/
    How do I solve this? is there a bug?

Viewing 11 replies - 1 through 11 (of 11 total)
  • Plugin Author Mustafa Uysal

    (@m_uysl)

    Hi @stefacchio,

    Could you provide more details about the problem? Where has the /wp-json part been removed? removed in cached results? or general?

    Thread Starter Stefano

    (@stefacchio)

    Hi @m_uysl, mmmh I didn’t understand exactly your question.
    When I enable the plugin with all enabled such as page cache, file css and js optimization, all blocks that do a fetch request with WP REST API, use the url without /wp-json/ getting a 404 error.
    Instead with plugin deactivated the fetch url is correct with /wp-json/ and all work fine.

    See following images

    Plugin Author Mustafa Uysal

    (@m_uysl)

    Could you share the link to the page you see this problem? If you prefer to not share publicly feel free to share via email (support[at]poweredcache[dot]com)

    Thread Starter Stefano

    (@stefacchio)

    Plugin Author Mustafa Uysal

    (@m_uysl)

    I think the problem is caused by deferring, https://share.cleanshot.com/f3xHF7D0

    Disable defer for wp-api resources and try again. (probably your site makes the requests for relative path /wp/….` when the base url is not set before making ajax calls.

    Thread Starter Stefano

    (@stefacchio)

    I developed the block, in the code I use a relative path as per the wordpress documentation.
    I wanted to benefit as much as possible by using the defer on each script… are there alternatives I can implement to not disable the defer?
    To disable the defer only on bees what should I enter in the defer field?

    Plugin Author Mustafa Uysal

    (@m_uysl)

    If Powered Cache is adding defer, you can enter wp-api(.*) in the exclusions. This allows you to disable defer for specific resources, so you can still benefit from it on others. Generally, deferring inline scripts can cause issues, so I suggest double-checking to avoid breaking any functionality on your site.

    Thread Starter Stefano

    (@stefacchio)

    Ok perfect. Thank you so much.
    I noticed another problem with plugin.

    After disable it, When I reactive the plugin the notification appears activated, but actually remains deactivated. In order to reactivate it, I have to deactivate and reactivate another plugin, after which powered cache is also activated

    Plugin Author Mustafa Uysal

    (@m_uysl)

    You’re welcome, and if you’re happy with the plugin, I’d greatly appreciate it if you could leave a review.

    After disable it, When I reactive the plugin the notification appears activated, but actually remains deactivated. In order to reactivate it, I have to deactivate and reactivate another plugin, after which powered cache is also activated

    I’m not totally sure if I’ve got this right ??. But object caching is often the usual suspect here — if it’s enabled, try purging it to clear out any stale data.

    Thread Starter Stefano

    (@stefacchio)

    I confirm, the problem is related to the object cache. Can’t you add a hook that empties the cache when you deactivate the plugin? It is really frustrating as a problem. Also, could you add a button that deactivates all the cache types in the plugin, but without deactivating the plugin? Or some sort of developing mode.

    • This reply was modified 2 weeks, 5 days ago by Stefano.
    Plugin Author Mustafa Uysal

    (@m_uysl)

    Can’t you add a hook that empties the cache when you deactivate the plugin?

    Not with hook, but technically we can drop the cache before unlinking object cache drop-in, however, this would not be an ideal decision for busy websites.

    It is really frustrating as a problem.

    Caching is a frustrating problem in general.

    Also, could you add a button that deactivates all the cache types in the plugin, but without deactivating the plugin? Or some sort of developing mode.

    I could, but I’d prefer not to add that — at least for now. You can use bypass functionality when testing pages: https://docs.poweredcache.com/bypass-functionality-in-powered-cache/

Viewing 11 replies - 1 through 11 (of 11 total)
  • You must be logged in to reply to this topic.