Hello I am using the Apps to serve a static website and want it to connect to an API
I am following the instructions
here https://docs.digitalocean.com/products/app-platform/reference/app-spec/
and here https://docs.digitalocean.com/products/app-platform/how-to/configure-cors-policies/
also https://registry.terraform.io/providers/digitalocean/digitalocean/latest/docs/resources/app#cors
But the format provided is not accepted when trying to add tot the Apps “App Spec” document Any ideas please
(also I added to the code from “services:” down the rest is pre-generated).
alerts:
- rule: DEPLOYMENT_FAILED
- rule: DOMAIN_FAILED
- disabled: true
rule: DEPLOYMENT_STARTED
- rule: DEPLOYMENT_LIVE
- rule: DOMAIN_LIVE
domains:
- domain: www.mywebsite.co.uk
type: PRIMARY
- domain: app.mywebsite.co.uk
type: ALIAS
- domain: admin.mywebsite.co.uk
type: ALIAS
ingress:
rules:
- component:
name: mywebsite-web-app-live
match:
path:
prefix: /
name: mywebsite-web-app-live
region: lon
static_sites:
- catchall_document: index.html
environment_slug: html
github:
branch: main
deploy_on_push: true
repo: MYCOMPANY/mywebsite-web-app-live
name: mywebsite-web-app-live
source_dir: /
services:
- cors:
allow_origins:
- prefix: https://api.mywebsite.co.uk
- prefix: https://*.mywebsite.co.uk
- prefix: https://mywebsite.co.uk
Also this link appiles you can use a UI to add cors but there is no option so might be outdated
https://docs.digitalocean.com/products/app-platform/how-to/configure-cors-policies/
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
Enter your email to get $200 in credit for your first 60 days with DigitalOcean.
New accounts only. By submitting your email you agree to our Privacy Policy.
Hey Phil, the CORS policies have moved under ingress rules. When you add a rule for your static site component, e.g.:
add your CORS policy in the rule:
This comment has been deleted