Skip to content

Commit

Permalink
Don't cache index.html (cvat-ai#4277)
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrey Zhavoronkov authored Feb 3, 2022
1 parent 29f14a8 commit f0b2a75
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 6 deletions.
1 change: 0 additions & 1 deletion Dockerfile.ui
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,5 @@ RUN npm run build:cvat-ui

FROM nginx:mainline-alpine
# Replace default.conf configuration to remove unnecessary rules
RUN sed -i "s/}/application\/wasm wasm;\n}/g" /etc/nginx/mime.types
COPY cvat-ui/react_nginx.conf /etc/nginx/conf.d/default.conf
COPY --from=cvat-ui /tmp/cvat-ui/dist /usr/share/nginx/html/
12 changes: 11 additions & 1 deletion cvat-ui/react_nginx.conf
Original file line number Diff line number Diff line change
@@ -1,7 +1,17 @@
server {
root /usr/share/nginx/html;
# Any route that doesn't have a file extension (e.g. /devices)

location / {
# Any route that doesn't exist on the server (e.g. /devices)
try_files $uri $uri/ /index.html;
add_header Cache-Control: "no-cache, no-store, must-revalidate";
add_header Pragma: "no-cache";
add_header Expires: 0;
}

location /assets {
expires 1y;
add_header Cache-Control "public";
access_log off;
}
}
8 changes: 4 additions & 4 deletions cvat-ui/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ module.exports = (env) => ({
},
output: {
path: path.resolve(__dirname, 'dist'),
filename: '[name].[contenthash].min.js',
filename: 'assets/[name].[contenthash].min.js',
publicPath: '/',
},
devServer: {
Expand Down Expand Up @@ -109,7 +109,7 @@ module.exports = (env) => ({
loader: 'worker-loader',
options: {
publicPath: '/',
name: '3rdparty/[name].[contenthash].js',
name: 'assets/3rdparty/[name].[contenthash].js',
},
},
},
Expand All @@ -120,7 +120,7 @@ module.exports = (env) => ({
loader: 'worker-loader',
options: {
publicPath: '/',
name: '[name].[contenthash].js',
name: 'assets/[name].[contenthash].js',
},
},
},
Expand All @@ -137,7 +137,7 @@ module.exports = (env) => ({
new CopyPlugin([
{
from: '../cvat-data/src/js/3rdparty/avc.wasm',
to: '3rdparty/',
to: 'assets/3rdparty/',
},
]),
],
Expand Down

0 comments on commit f0b2a75

Please sign in to comment.