Question

Do Digital Ocean App Specifications support wildcards for URL rewrites and redirects?

Hi Digital Ocean Community,

I host a static personal website on Digital Ocean App Platform. I want every request that excludes the .html extension to redirect to the .html page. Currently I have to write each of these rules individually per page, as shown below.

For example: tobkin.us/contact ->302-> tobkin.us/contact.html

Is there any way I can use a wildcard instead to condense this App Specification? Or even better, rewrite all *.html pages to have no extension so there is no redirect?

ingress:
  rules:
  - component:
      name: tobkin-static-html
    match:
      path:
        prefix: /
  - match:
      path:
        prefix: /index
    redirect:
      redirect_code: 301
      uri: /index.html
  - match:
      path:
        prefix: /resume
    redirect:
      redirect_code: 301
      uri: /resume.html
  - match:
      path:
        prefix: /contact
    redirect:
      redirect_code: 301
      uri: /contact.html
  - match:
      path:
        prefix: /office-hours
    redirect:
      redirect_code: 301
      uri: /office-hours.html

Submit an answer


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!

Sign In or Sign Up to Answer

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.

Hey,

I believe that the DigitalOcean App Platform doesn’t currently support wildcard URL rewrites or redirects directly within the App Spec configuration. Each route has to be specified individually, as you’ve been doing.

The best thing to do to get your voice heard regarding this would be to head over to the DigitalOcean Product Ideas board and post a new idea, including as much information as possible for what you’d like to see implemented.

https://ideas.digitalocean.com/

Hope that helps!

- Bobby.

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Become a contributor for community

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

DigitalOcean Documentation

Full documentation for every DigitalOcean product.

Resources for startups and SMBs

The Wave has everything you need to know about building a business, from raising funding to marketing your product.

Get our newsletter

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

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.