diff --git a/Dockerfile.ui b/Dockerfile.ui index bc513e7c..a6dd2599 100644 --- a/Dockerfile.ui +++ b/Dockerfile.ui @@ -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/ diff --git a/cvat-ui/react_nginx.conf b/cvat-ui/react_nginx.conf index 9a8bbc92..5b6ea16d 100644 --- a/cvat-ui/react_nginx.conf +++ b/cvat-ui/react_nginx.conf @@ -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; } } diff --git a/cvat-ui/webpack.config.js b/cvat-ui/webpack.config.js index 213b0d92..7d0e1a42 100644 --- a/cvat-ui/webpack.config.js +++ b/cvat-ui/webpack.config.js @@ -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: { @@ -109,7 +109,7 @@ module.exports = (env) => ({ loader: 'worker-loader', options: { publicPath: '/', - name: '3rdparty/[name].[contenthash].js', + name: 'assets/3rdparty/[name].[contenthash].js', }, }, }, @@ -120,7 +120,7 @@ module.exports = (env) => ({ loader: 'worker-loader', options: { publicPath: '/', - name: '[name].[contenthash].js', + name: 'assets/[name].[contenthash].js', }, }, }, @@ -137,7 +137,7 @@ module.exports = (env) => ({ new CopyPlugin([ { from: '../cvat-data/src/js/3rdparty/avc.wasm', - to: '3rdparty/', + to: 'assets/3rdparty/', }, ]), ],