kattair0ta8
How to properly make use of browser caching with nginx on production?
I have an app working behind nginx. The users can authenticate on my website.
I’m looking into utilize browser caching on production. There’s no clear information of how to achieve this.
One issue is that, as I’ve mentioned, the users can authenticate on my website. And as I’ve found out, some articles claim that “Cache-Control: public” won’t work properly because nginx might return authenticated, cached page to unauthenticated user. But this isn’t still clear, whether or not it’s the case.
How can I leverage browser caching in the first place? Properly. Many articles about this contradict each other or semi-complete.
Most Liked
idi527
Do you plan to cache whole web pages?
As far as I understand, nginx can’t decide whether a user is authenticated by just looking at the default (in phoenix) headers without asking your app. A simpler set up would be to put the cache (if any) in the application layer. For a more involved set up with nginx cache (at the proxy layer), see https://softwareengineering.stackexchange.com/questions/299535/caching-authenticated-requests-for-all-users.
You can safely cache public assets like js/css/etc.
NobbZ
No, your question is.
What have you tried so far? What makes you think it is not working as expected?
I’m by far an expert on caching in any way, but what I can tell you, it is hard to do right.
For client side caching there are only a handfull of headers you may set to suggest some caching to the client, but still the client is free to ignore those.
So without knowing what headers you have set, and which browser you used for testing and with which settings, we really can’t help you.
Popular in Questions
Other popular topics
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #advent-of-code
- #elixirconf-us
- #distillery
- #processes
- #forms
- #api
- #metaprogramming
- #security
- #performance









