-
Notifications
You must be signed in to change notification settings - Fork 34
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
headers caching for multi-tenant #137
Comments
Hi @fernandohonig, Thanks for raising the issue. For example: |
Hi @DianaIonita, thanks for taking the time. Yes, it’s enabled but the difference is that the caching is not on the query string as shown in your picture, but in the request headers. |
@DianaIonita any ideas about this?. Thanks. |
Hi @fernandohonig, Apologies for the delay. Here's what I tried:
plugins:
- serverless-api-gateway-caching
custom:
apiGatewayCaching:
enabled: true
functions:
list-cats:
handler: rest_api/cats/get/handler.handle
events:
- http:
path: /cats
method: get
caching:
enabled: true
cacheKeyParameters:
- name: request.header.customer-id
In your configuration, can you tell if anything differs from what I tried? |
Hi @DianaIonita, thanks again for taking the time. Does this only work with GET or also POST methods? (Some functions we have despite using a POST method, are used to get information. Also, is request.header case sensitive? If I am sending "Customer-Id" the name: needs to be "Customer-Id" or it could be "customer-id" ? |
Hi @fernandohonig, All cache key parameters are case-sensitive, yes, this is how API Gateway works. If you call an endpoint with header Caching works with both GET and POST methods. |
So then I don’t understand why it doesn’t work on my end. I have it configured just like you but when I execute a get or a post with 1 Customer-Id and then try the same with another Customer-Id the results for the second one is the same as the first one. |
Hey @fernandohonig, Can you try reproducing it in a very simple public repository so that I can debug based on that? |
Hi!
We have a SaaS app and we use a custom header to define the customer-id and send that to the APIs we have.
In every request, we have that customer-id header.
When I enable caching, data from one customer is shown in another customer, like it's not respecting the customer-id key I set in every function.
For instance:
What am I doing wrong?. Thanks!
The text was updated successfully, but these errors were encountered: