Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AWS Cloud9 doesn't allow static manifest.json but does allow css file

Tags:

I am developing a PWA in AWS Cloud9, but it won't allow my manifest.json to be included/referenced in a link tag. It says "VFS Connection is not present" in dev tools as if it can't find the manifest because it is external to the app. I get a 499 error in the console. This is the same message I get if I stop the node http-server and reload the preview page, because it isn't being served up on port 8080. It DOES find the CSS file in a link tag just fine (in the same folder), so is it because it is rel=manifest, or it won't allow a json file to be included for security reasons, or some other reason? Does anyone know why this file isn't working?

<link rel="manifest" href="manifest.json" /> 
like image 485
Ryan Avatar asked May 20 '18 05:05

Ryan


2 Answers

This occurs because the request for the manifest file is done without using cookies/credentials, but the VFS proxy uses a cookie to restrict access to the development preview. Essentially the 499 & error message actually mean access denied.

This question describes the issue more generically: Cookies not sent with request for Web App manifest.json

I have confirmed that this works with AWS cloud9 & Google Chrome 78.

<link rel="manifest" href="/manifest.json" crossOrigin="use-credentials">

like image 78
trognanders Avatar answered Sep 28 '22 04:09

trognanders


Its mainly because right now your app is not publicly accessible on port 80, once you will go live it shouldn't be a problem.

Update - Alternate method below

You can put the manifest json content as base64 encoded string in the html itself. Below is the sample manifest json and its implementation in the link tag on the page.

{   "name": "your app name",   "gcm_sender_id": "xxxxxxx",   "gcm_user_visible_only": "true" } 

On HTML page -

<link rel="manifest" href="data:application/manifest+json;base64,ewogICJuYW1lIjogInlvdXIgYXBwIG5hbWUiLAogICJnY21fc2VuZGVyX2lkIjogInh4eHh4eHgiLAogICJnY21fdXNlcl92aXNpYmxlX29ubHkiOiAidHJ1ZSIKfQ=="> 
like image 35
mdeora Avatar answered Sep 28 '22 03:09

mdeora