简体   繁体   中英

Not able to download apple-app-site-association on google cloud engine, however locally all ok (angular)

Trying to setup this file first locally. Which now works after I shut down the app and executed a new ng serve command.

Now also doing this after deploying to google app engine, however here I'm not able to make it work. Even not if it's placed directly in the assets folder which is strange to me, as this one is clearly open as other site assets can be downloaded from here.

Recapping, this works, entering this in a browser, it will download the file:

http://localhost:4200/.well-known/apple-app-site-association

However this: https://www.urlofmysite.com/.well-known/apple-app-site-association does not work.

Btw, the file has no extention, that's how I understand it from: https://capacitorjs.com/docs/guides/deep-links and some other sources. The error message my console gives is:

ERROR Error: Uncaught (in promise): Error: Cannot match any routes. URL Segment: '.well-known/apple-app-site-association'
Error: Cannot match any routes. URL Segment: '.well-known/apple-app-site-association'

This was btw the exact same message I had when opening the file locally before pressing ctrl+c and ng serve again.

The only thing I can image is my app.yml file needs some updated config. This is this file:

runtime: python27
api_version: 1
threadsafe: true
handlers:
  - url: /(.*\.(gif|png|jpg|ico|css|js)(|\.map))$
    secure: always
    redirect_http_response_code: 301
    static_files: dist/listdropper/\1
    upload: dist/listdropper/(.*)(|\.map)
    http_headers:
      Strict-Transport-Security: max-age=31536000; includeSubDomains

  - url: /(.*)
    secure: always
    redirect_http_response_code: 301
    static_files: dist/listdropper/index.html
    upload: dist/listdropper/index.html
    http_headers:
      Strict-Transport-Security: max-age=31536000; includeSubDomains

skip_files:
  - e2e/
  - node_modules/
  - src/
  - coverage
  - ^(.*/)?\..*$
  - ^(.*/)?.*\.json$
  - ^(.*/)?.*\.md$
  - ^(.*/)?.*\.yaml$
  - ^LICENSE

The file I am trying to download is stored inside /src/.well-known folder

Hope there's a simple solution. Thanks a lot for taking a look at this question!

I fixed it by checking in the web console the debug option:

https://console.cloud.google.com/appengine/versions?serviceId=default&project=insertyourprojectnamehere

Here there's a list of versions. Take the active one, scroll all the way to the right, and click TOOLS > Debug

The FE logs indicated the file was not there. Which I saw because now I saw the actual file structure as well on the server (left column). I added/uploaded the file to the root of the angular project directly next to some other files I did see showing up here (by changing it in src and then an ng-build and gcloud app deploy . Finally changed my app.yaml to now include this file. It gave me the file correctly. :)

This segment is the first one in the handlers part:

  - url: /.*/(.*apple\-app\-site\-association)   #   this works
    static_files: apple-app-site-association
    upload: apple-app-site-association
    secure: always
    redirect_http_response_code: 301
    http_headers:
      Strict-Transport-Security: max-age=31536000; includeSubDomains

Ending with another ng-build and gcloud app deploy of course (or combine the two steps and then execute the ng-build stuff)

Hope it will help someone in the future!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM