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

Do not cache all JSON requests (API-REST) in nginx #189

Open
javiercasares opened this issue Mar 17, 2023 · 4 comments
Open

Do not cache all JSON requests (API-REST) in nginx #189

javiercasares opened this issue Mar 17, 2023 · 4 comments
Labels
documentation Improvements or additions to documentation enhancement New feature or request help wanted Extra attention is needed

Comments

@javiercasares
Copy link
Collaborator

javiercasares commented Mar 17, 2023

As per
https://fosstodon.org/@webaware/110037286062251716

In nginx, we should not cache JSON requests in some cases.

if ($http_accept = "application/json") {
	set $no_cache 1;
}
@javiercasares javiercasares added documentation Improvements or additions to documentation enhancement New feature or request help wanted Extra attention is needed labels Mar 17, 2023
@javiercasares
Copy link
Collaborator Author

@javiercasares javiercasares changed the title Do nor cache json in nginx Do not cache all JSON requests (API-REST) in nginx Mar 17, 2023
@javiercasares
Copy link
Collaborator Author

Some information related with JSON and the Fediverse at
https://github.com/pfefferle/wordpress-activitypub/blob/master/includes/class-activitypub.php#L78-L81

@futtta
Copy link

futtta commented Mar 17, 2023

In nginx, we should not cache JSON requests in some cases.

if ($http_accept = "application/json") {
	set $no_cache 1;
}

as activitypub supports 4 different json-ish mime-types, it might be better not to cache if mimetype is text/html?

if ($http_accept != "text/html") {
	set $no_cache 1;
}

@javiercasares
Copy link
Collaborator Author

@pfefferle any suggestions?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants