diff --git a/spec/pwa_test.js b/spec/pwa_test.js
index 57375faa48cef24eeac5a62ab84454cc27e14d81..a5405c4c174f674a66625dadd5757c2e7a36be4d 100644
--- a/spec/pwa_test.js
+++ b/spec/pwa_test.js
@@ -133,14 +133,14 @@ describe('Service delivers a generated web-manifest', function () {
     })
     const response = await request(app.server).get('/pwa.json').set('host', 'ui-server')
     expect(response.statusCode).to.equal(500)
-    expect(response.text).to.have.string('Failed to load config for url ui-server: Error:')
+    expect(response.text).to.have.string('Failed to load config for url https://ui-server/pwa.json: Error:')
   })
 
   it('must not deliver a manifest with invalid host', async function () {
     const app = await mockApp()
     const response = await request(app.server).get('/pwa.json').set('host', 'ui-server-not')
     expect(response.statusCode).to.equal(500)
-    expect(response.text).to.equal('Failed to load config for url ui-server-not: Error: Failed to fetch https://ui-server-not/api/apps/manifests?action=config')
+    expect(response.text).to.equal('Failed to load config for url https://ui-server-not/pwa.json: Error: Failed to fetch https://ui-server-not/api/apps/manifests?action=config')
   })
 
   it('delivers valid webmanifest with raw_manifest', async function () {
@@ -219,7 +219,7 @@ describe('Service delivers a generated web-manifest', function () {
     })
     const response = await request(app.server).get('/pwa.json').set('host', 'ui-server')
     expect(response.statusCode).to.equal(500)
-    expect(response.text).to.have.string('Failed to load config for url ui-server: Error:')
+    expect(response.text).to.have.string('Failed to load config for url https://ui-server/pwa.json: Error:')
   })
 
   it('must choose raw_manifest over short syntax', async function () {
diff --git a/src/create-app.js b/src/create-app.js
index 398105dbe7b54850e5dd4e9d4416021d65988f38..777add958807084305bd8fc40f359b5adb915d46 100644
--- a/src/create-app.js
+++ b/src/create-app.js
@@ -80,7 +80,7 @@ export async function createApp (basePath) {
   }
 
   await app.register(serveFilePlugin)
-  await app.register(serveWebmanifest)
+  await app.register(serveWebmanifest, { prefix: process.env.APP_ROOT })
 
   return app
 }
diff --git a/src/plugins/webmanifest.js b/src/plugins/webmanifest.js
index 682f76ca1e9bc1e789f53997a5bb0318ea104bd2..9216a98b5da47f95c2696cbf0c62e7ceba999569 100644
--- a/src/plugins/webmanifest.js
+++ b/src/plugins/webmanifest.js
@@ -32,21 +32,23 @@ const template = {
 
 export default async function serveWebmanifest (fastify) {
   fastify.get('/pwa.json', async (req, res) => {
-    const hostname = req.hostname
+    const urlData = req.urlData()
+    const url = `https://${urlData.host}${urlData.path}`
+
     try {
-      const cached = await get(getRedisKey({ name: `cachedManifest:${hostname}` }), async () => [await fetchWebManifest(hostname), 86400])
+      const cached = await get(getRedisKey({ name: `cachedManifest:${url}` }), async () => [await fetchWebManifest(url), 86400])
       res.type('application/manifest+json')
       res.send(cached)
     } catch (err) {
       res.statusCode = 500
-      res.send(`Failed to load config for url ${hostname}: ${err}`)
+      res.send(`Failed to load config for url ${url}: ${err}`)
     }
   })
 }
 
-async function fetchWebManifest (hostname) {
-  const url = new URL('/api/apps/manifests?action=config', 'https://' + hostname)
-  const conf = await fetch(url)
+async function fetchWebManifest (url) {
+  const serverConfigURL = new URL('/api/apps/manifests?action=config', url)
+  const conf = await fetch(serverConfigURL)
 
   if (conf.ok) {
     const data = (await conf.json()).data
@@ -60,7 +62,7 @@ async function fetchWebManifest (hostname) {
     const webmanifest = JSON.stringify(combinedManifest, null, 2)
     return webmanifest
   } else {
-    throw new Error(`Failed to fetch ${url}`)
+    throw new Error(`Failed to fetch ${serverConfigURL}`)
   }
 }