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

Support for skip Nginx caching on custom defined URL slugs #175

Open
bari86 opened this issue Sep 19, 2022 · 8 comments
Open

Support for skip Nginx caching on custom defined URL slugs #175

bari86 opened this issue Sep 19, 2022 · 8 comments

Comments

@bari86
Copy link

bari86 commented Sep 19, 2022

some e-commerce site require certain custom path to be excluded from cache. since SS always cache almost everything and hardcoded code, there is no function to add custom path to exclude from cache. please add this as soon as possible as its vital feature to exclude cache on certain url

i believe in the modules>nginx>sites>production.txt there are this code

## ENGLISH - sensitive wordpress urls should always skip the cache if ($request_uri ~* "index.php|/account.*|/cart.*|/checkout.*|/contact.*|/dashboard.*|/login.*|/my-.*|/order.*|/profile.*|/register.*|/settings.*|/view.*|/wc-api.*|/wp-admin.*|wp-.*.php") { set $skip_cache 1; }

in which allow custom url that can be skipped from cache. can you in a way make it easier for us to define any custom path to skip cache?

@bari86
Copy link
Author

bari86 commented Sep 19, 2022

a really simple solution would be something like add /ex-* so we can just add the path like "ex-" as prefix and viola, no cache. then would be /ex-path1 or /ex-path2 etc.

@jessuppi
Copy link
Member

Thanks for the suggestion @bari86

As per our discussion on Discord, I'm not opposed to adding this feature. However, over the past few years, every time someone has requested this feature and I've asked for a case example, it's always some poorly coded plugin that is not properly using the WooCommerce checkout, or something like that.

The case you shared in Discord was re: Cartflows, a type of funnel-building plugin that hacks WooCommerce cookies... my opinion is that such plugins are rather gimmicky and unstable, and not worthy of supporting. TLDR even if we added custom URL skip cache rules, I'm guessing there are going to be other conflicts with that plugin...

In other words I think the concept of custom URLs for skip cache is fine, but in practice I haven't seen a need for it. Rather than offering tons of jiggery hackery customization features, we've been really careful about things like this.

For example, if someone wants to skip cache on foreign language WooCommerce slugs, the "official" view of SlickStack is that we should add new rules for that language, and then hardcode it. In other words, using community feedback to determine changes to our hardcoded source vs. having dynamic features everywhere.

After several years and hundreds of clients using SlickStack (many with millions of sales per year) I've still never had a successful client require such customization.

@jessuppi
Copy link
Member

Still, at least for the purpose of debugging or emergency fixes, it's probably a good feature to add. So I think we can proceed with adding a custom skip cache feature on a sort of preliminary basis and see how it goes.

This will also need to keep in mind the foreign language slugs that are currently hardcoded in production block:

Ref: https://github.com/littlebizzy/slickstack/blob/master/modules/nginx/sites/production.txt

It might be a good idea to address both of these issues at the same time. For example, moving the language slugs into their own Nginx submodule files like /etc/nginx/conf.d/english.conf or whatever...

@jessuppi
Copy link
Member

This has been sitting for 2 years: #43

@jessuppi jessuppi changed the title No cache on custom path Support for skip Nginx caching on custom defined URL slugs Sep 20, 2022
@jessuppi
Copy link
Member

Also see @backamblock comment on that thread:

suggestion:
ask about language in the installer script and link it to a file in your repository. everybody who needs a language should contribute the file with the correct translations.
Workaround for not yet accepted contributions: set own URL or path to language files in the ss-config

example file: "de_DE.txt"

@jessuppi
Copy link
Member

I mention this because we have discussed in the past defining custom URLs in ss-config for skip caching... and in the future, I'm guessing some users will want that feature directly in the WP Admin SlickStack dashboard.

But for now I guess the easiest solution is just dropping a file in /etc/nginx/conf.d/ with your desired skip cache rules, however I'm hoping we can standardize the filename at least.

We also need test to make sure all these (new) Nginx files are working together, since defining rules in submodules loads differently than with server blocks...

@bari86
Copy link
Author

bari86 commented Sep 20, 2022

Hi,
I do understand that my example was using the Cartflows plugin, but let think it as a general way to skip cache if needed. Some cache plugin do allow certain slug to skip cache, which might be important to either debug, or certain case scenario. So would be good to allow at least certain pre-defined slug, example 'ex-.' so someone can name it /ex-custompath if needed. this would require just one extra slug in your existing setup, or you can put in some custom txt file that it can refer to but it might complicates thing?

adding custom url in ss-config would be good too but it might takes time to do it. keep up the good work.

@jessuppi
Copy link
Member

jessuppi commented Apr 9, 2023

Related:

#43

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

No branches or pull requests

2 participants