mirror of
https://github.com/hcengineering/platform.git
synced 2024-11-25 09:13:07 +03:00
UBERF-7362: Do not cache branding served from front (#5889)
Signed-off-by: Alexey Zinoviev <alexey.zinoviev@xored.com>
This commit is contained in:
parent
ece5c0ec6c
commit
55a030d383
@ -84,6 +84,7 @@ services:
|
|||||||
- COLLABORATOR_URL=ws://localhost:3078
|
- COLLABORATOR_URL=ws://localhost:3078
|
||||||
- COLLABORATOR_API_URL=http://localhost:3078
|
- COLLABORATOR_API_URL=http://localhost:3078
|
||||||
- STORAGE_CONFIG=${STORAGE_CONFIG}
|
- STORAGE_CONFIG=${STORAGE_CONFIG}
|
||||||
|
- BRANDING_URL=http://localhost:8087/branding.json
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
collaborator:
|
collaborator:
|
||||||
image: hardcoreeng/collaborator
|
image: hardcoreeng/collaborator
|
||||||
|
@ -205,7 +205,7 @@ export async function configurePlatform() {
|
|||||||
configureI18n()
|
configureI18n()
|
||||||
|
|
||||||
const config: Config = await (await fetch(devConfig? '/config-dev.json' : '/config.json')).json()
|
const config: Config = await (await fetch(devConfig? '/config-dev.json' : '/config.json')).json()
|
||||||
const branding: BrandingMap = await (await fetch(config.BRANDING_URL ?? '/branding.json')).json()
|
const branding: BrandingMap = config.BRANDING_URL !== undefined ? await (await fetch(config.BRANDING_URL)).json() : {}
|
||||||
const myBranding = branding[window.location.host] ?? {}
|
const myBranding = branding[window.location.host] ?? {}
|
||||||
|
|
||||||
console.log('loading configuration', config)
|
console.log('loading configuration', config)
|
||||||
|
@ -304,6 +304,15 @@ export function start (
|
|||||||
const dist = resolve(process.env.PUBLIC_DIR ?? cwd(), 'dist')
|
const dist = resolve(process.env.PUBLIC_DIR ?? cwd(), 'dist')
|
||||||
console.log('serving static files from', dist)
|
console.log('serving static files from', dist)
|
||||||
|
|
||||||
|
let brandingUrl: URL | undefined
|
||||||
|
if (config.brandingUrl !== undefined) {
|
||||||
|
try {
|
||||||
|
brandingUrl = new URL(config.brandingUrl)
|
||||||
|
} catch (e) {
|
||||||
|
console.error('Invalid branding URL. Must be absolute URL.', e)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
app.use(
|
app.use(
|
||||||
expressStaticGzip(dist, {
|
expressStaticGzip(dist, {
|
||||||
serveStatic: {
|
serveStatic: {
|
||||||
@ -314,7 +323,10 @@ export function start (
|
|||||||
lastModified: true,
|
lastModified: true,
|
||||||
index: false,
|
index: false,
|
||||||
setHeaders (res, path) {
|
setHeaders (res, path) {
|
||||||
if (path.toLowerCase().includes('index.html')) {
|
if (
|
||||||
|
path.toLowerCase().includes('index.html') ||
|
||||||
|
(brandingUrl !== undefined && path.toLowerCase().includes(brandingUrl.pathname))
|
||||||
|
) {
|
||||||
res.setHeader('Cache-Control', cacheControlNoCache)
|
res.setHeader('Cache-Control', cacheControlNoCache)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -78,7 +78,7 @@ services:
|
|||||||
- COLLABORATOR_URL=ws://localhost:3079
|
- COLLABORATOR_URL=ws://localhost:3079
|
||||||
- COLLABORATOR_API_URL=http://localhost:3079
|
- COLLABORATOR_API_URL=http://localhost:3079
|
||||||
- STORAGE_CONFIG=${STORAGE_CONFIG}
|
- STORAGE_CONFIG=${STORAGE_CONFIG}
|
||||||
- BRANDING_URL=/branding-test.json
|
- BRANDING_URL=http://localhost:8083/branding-test.json
|
||||||
transactor:
|
transactor:
|
||||||
image: hardcoreeng/transactor
|
image: hardcoreeng/transactor
|
||||||
pull_policy: never
|
pull_policy: never
|
||||||
|
Loading…
Reference in New Issue
Block a user