DEV Community

Cover image for How to force nginx webserver to reload client's browser for new release ?
SyedAsadRazaDevops
SyedAsadRazaDevops

Posted on

3

How to force nginx webserver to reload client's browser for new release ?

During a server migration a new nginx configuration was missing cache conrol directives. Hence, we ended up with a cached index.html which is very bad for our SPA that is not refreshed anymore if we deploy new code. We need the index.html to not be cached.

To configure Nginx to not reload a website from the cache when a client user hits the website, you can use the proxy_cache_bypass directive.

server {
    root /var/www/public_html/react/build;
    index index.html index.htm index.nginx-debian.html;
    server_name myapp.com www.myapp.com;

 location / {
        try_files $uri  /index.html;

    proxy_cache my_cache;
    proxy_cache_bypass $http_pragma;
    proxy_cache_revalidate on;
    proxy_cache_min_uses 3;
    proxy_cache_valid 200 60m;
    proxy_cache_valid 404 1m;
    proxy_cache_valid any 0;

    add_header Cache-Control "no-store, no-cache, must-revalidate";
    add_header Cache-Control "max-age=31536000, public";
    }
Enter fullscreen mode Exit fullscreen mode

Image of AssemblyAI tool

Transforming Interviews into Publishable Stories with AssemblyAI

Insightview is a modern web application that streamlines the interview workflow for journalists. By leveraging AssemblyAI's LeMUR and Universal-2 technology, it transforms raw interview recordings into structured, actionable content, dramatically reducing the time from recording to publication.

Key Features:
🎥 Audio/video file upload with real-time preview
🗣️ Advanced transcription with speaker identification
⭐ Automatic highlight extraction of key moments
✍️ AI-powered article draft generation
📤 Export interview's subtitles in VTT format

Read full post

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

👋 Kindness is contagious

Dive into an ocean of knowledge with this thought-provoking post, revered deeply within the supportive DEV Community. Developers of all levels are welcome to join and enhance our collective intelligence.

Saying a simple "thank you" can brighten someone's day. Share your gratitude in the comments below!

On DEV, sharing ideas eases our path and fortifies our community connections. Found this helpful? Sending a quick thanks to the author can be profoundly valued.

Okay