Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Web App Manifest blocked by CORS when hosted behind authentication #1802

Open
WillsB3 opened this issue Aug 10, 2019 · 11 comments
Open

Web App Manifest blocked by CORS when hosted behind authentication #1802

WillsB3 opened this issue Aug 10, 2019 · 11 comments
Labels
Resolution: Needs Investigation This PR or Issue should be investigated from the Stencil team

Comments

@WillsB3
Copy link

WillsB3 commented Aug 10, 2019

Stencil version:

@stencil/core@1.2.3

I'm submitting a:
[x] bug report
[ ] feature request
[ ] support request

Current behavior:
Currently, when deploying a Stencil site / app to a host behind authentication, the manifest file fails to load with the following error:

Access to manifest at 'https://path.to/my-site/manifest.json' from origin 'https://path.to' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.

Expected behavior:
The manifest should be loaded with crossorigin="use-credentials" so that the browser sends the auth credentials when requesting the manifest. See MDN for details.

Steps to reproduce:

  1. Deploy the starter app to a location that is behind authentication.
  2. Open DevTools and observe that the manifest does not load due to a CORS error.

Other information:
I'm not sure where the template for the generated index.html file lives, but I believe this fix should be as simple as changing:

<link rel="manifest" href="./manifest.json">

to

<link rel="manifest" href="./manifest.json" crossorigin="use-credentials">
@ionitron-bot ionitron-bot bot added the triage label Aug 10, 2019
@patrickfoley
Copy link

Hey man, this helped me solve the same issue for an S3/CloudFront website - thanks for making it google-able!

@iamhammadaali
Copy link

How Can i solve this problem? adding crossorigin is not solving this.

@pranaynailwal
Copy link

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

this worked for me too.

@marcchew
Copy link

it doesn't work

@splitinfinities
Copy link
Contributor

Adding crossorigin may be the initial solution we come to, however there may be more circumstances where this cannot work. We will need more information - can you please create a reproduction repo and link here? If you can also speak to any nginx/Apache/Aws rules you set, that would help as well.

@splitinfinities splitinfinities added triage Awaiting Reply This PR or Issue needs a reply from the original reporter. labels Nov 14, 2021
@ionitron-bot ionitron-bot bot removed the triage label Nov 14, 2021
@rwaskiewicz rwaskiewicz added Resolution: Needs Investigation This PR or Issue should be investigated from the Stencil team and removed Feature: Prerendering/SSG labels Mar 25, 2022
@jayaamamidala
Copy link

Adding <link rel="manifest" href="%PUBLIC_URL%/manifest.json" crossorigin="use-credentials"> did not solve the problem, are there any other suggestions for this ?

@ionitron-bot ionitron-bot bot removed the Awaiting Reply This PR or Issue needs a reply from the original reporter. label Mar 30, 2022
@tmchow
Copy link

tmchow commented Jun 26, 2022

I had same issue and was tearing my hair out. crossorigin="use-credentials" worked for us! Thanks!

@kushankurdas
Copy link

kushankurdas commented Feb 25, 2023

replace this with <link rel="manifest" href="./manifest.json" /> will solve the issue

@ManiMatter
Copy link

this worked for me too.

@abhijith1741
Copy link

abhijith1741 commented May 16, 2023

hey, the issue is happen not only because of the crossorigin, may be you run the web app through the path.
so instead of that run it with a live server issues will be resolve.

@joaoefmota
Copy link

My app is hosted on Azure, and the container only allows authenticated traffic. So, the PWA runs except the images do not render until the page is hard refreshed. So, in this scenario, it routes the user to the login page (Microsoft) and then, once back to the PWA landing page, puff we have the images rendered. It is not a desired behaviour for sure.
By checking the console on the browser, I can see that the access to font, manifest and internal resource are blocked by CORS policy (No access-Control-Allow-Origin header), even if I inclued the crossorigin="use-cedentials" on my index.html. No idea how do solve this, any clue please?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Resolution: Needs Investigation This PR or Issue should be investigated from the Stencil team
Projects
None yet
Development

No branches or pull requests