Don't cache index.html (#4277)

main
Andrey Zhavoronkov 4 years ago committed by GitHub
parent 29f14a814a
commit f0b2a75125
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -37,6 +37,5 @@ RUN npm run build:cvat-ui
FROM nginx:mainline-alpine FROM nginx:mainline-alpine
# Replace default.conf configuration to remove unnecessary rules # 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 cvat-ui/react_nginx.conf /etc/nginx/conf.d/default.conf
COPY --from=cvat-ui /tmp/cvat-ui/dist /usr/share/nginx/html/ COPY --from=cvat-ui /tmp/cvat-ui/dist /usr/share/nginx/html/

@ -1,7 +1,17 @@
server { server {
root /usr/share/nginx/html; root /usr/share/nginx/html;
# Any route that doesn't have a file extension (e.g. /devices)
location / { location / {
# Any route that doesn't exist on the server (e.g. /devices)
try_files $uri $uri/ /index.html; 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;
} }
} }

@ -21,7 +21,7 @@ module.exports = (env) => ({
}, },
output: { output: {
path: path.resolve(__dirname, 'dist'), path: path.resolve(__dirname, 'dist'),
filename: '[name].[contenthash].min.js', filename: 'assets/[name].[contenthash].min.js',
publicPath: '/', publicPath: '/',
}, },
devServer: { devServer: {
@ -109,7 +109,7 @@ module.exports = (env) => ({
loader: 'worker-loader', loader: 'worker-loader',
options: { options: {
publicPath: '/', publicPath: '/',
name: '3rdparty/[name].[contenthash].js', name: 'assets/3rdparty/[name].[contenthash].js',
}, },
}, },
}, },
@ -120,7 +120,7 @@ module.exports = (env) => ({
loader: 'worker-loader', loader: 'worker-loader',
options: { options: {
publicPath: '/', publicPath: '/',
name: '[name].[contenthash].js', name: 'assets/[name].[contenthash].js',
}, },
}, },
}, },
@ -137,7 +137,7 @@ module.exports = (env) => ({
new CopyPlugin([ new CopyPlugin([
{ {
from: '../cvat-data/src/js/3rdparty/avc.wasm', from: '../cvat-data/src/js/3rdparty/avc.wasm',
to: '3rdparty/', to: 'assets/3rdparty/',
}, },
]), ]),
], ],

Loading…
Cancel
Save