By Phill
Hello I have a static App on DO using the App importing from a GIT repository.
I have followed the instructions here including the .yaml file example but it keeps getting rejected
https://docs.digitalocean.com/products/app-platform/reference/app-spec/
alerts:
- rule: DEPLOYMENT_FAILED
- disabled: true
rule: DOMAIN_FAILED
- disabled: true
rule: DEPLOYMENT_STARTED
- disabled: true
rule: DEPLOYMENT_CANCELED
- rule: DEPLOYMENT_LIVE
- disabled: true
rule: DOMAIN_LIVE
domains:
- domain: mywebsite.uk
type: PRIMARY
ingress:
rules:
- component:
name: mywebsite-web-app-staging
match:
path:
prefix: /
name: mywebsite-app-staging
region: lon
services:
- cors:
allow_origins:
- prefix: https://api.mywebsite.com
static_sites:
- catchall_document: index.html
environment_slug: html
github:
branch: main
deploy_on_push: true
repo: xxxx/mywebsite-web-app-staging
name: mywebsite-web-app-staging
source_dir: /
Above is a copy of the .yaml the system produces with only the
services:
- cors:
allow_origins:
- prefix: https://api.mywebsite.com
added.
Thanks
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!
Hey Phil,
I’ve noticed that this is a duplicate question and my colleague Greg has already answered this here:
The CORS policies have moved under ingress rules. When you add a rule for your static site component, e.g.:
ingress:
rules:
- component:
name: mywebsite-web-app-live
match:
path:
prefix: /
Add your CORS policy in the rule:
ingress:
rules:
- component:
name: mywebsite-web-app-live
match:
path:
prefix: /
cors:
allow_origins:
- prefix: https://api.mywebsite.co.uk
- prefix: https://*.mywebsite.co.uk
- prefix: https://mywebsite.co.uk
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.