Question

How to redirect http to https on app platform

Hello fellow developers,

I’m using app platform to host a static website, and while my domain is registered on godaddy, I’ve pointed the nameservers to DO and everything is working fine with my domain. The problem happens when I enter the domain using http instead of https. How to redirect all http requests to https? For reference, my domain is twowords.design. According to this question, it’s not possible yet: https://www.digitalocean.com/community/questions/how-to-redirect-301-on-the-digital-ocean-apps-platform However, it says here that http should automatically be redirected to https: https://www.digitalocean.com/community/questions/is-possible-disable-http-in-digital-app-platform-static-site

Show comments

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.

Dikshith Shetty
DigitalOcean Employee
DigitalOcean Employee badge
June 8, 2021
Accepted Answer

Hello @bavly

Yes, the domain will automatically be redirected to HTTPS and there are no changes required from your end. Already, I see the domain with HTTP link http://twowords.design/ is getting redirected to https://twowords.design/ successfully.

You can check the Location field in the below curl output:

curl -I http://twowords.design/ 
HTTP/1.1 301 Moved Permanently
Date: Tue, 08 Jun 2021 17:16:10 GMT
Connection: keep-alive
Cache-Control: max-age=3600
Expires: Tue, 08 Jun 2021 18:16:10 GMT
Location: https://twowords.design/
cf-request-id: 0a8e38f747000031b80e123000000001
Server: cloudflare
CF-RAY: 65c3c4387f1a31b8-BOM

The dig output is returning 3 IP addresses in which one associated with Droplet 161.35.103.124 so when it resolves to that IP address you might experience the issue. Please remove that Droplet IP address from A record list:

dig twowords.design +short
161.35.103.124
104.16.244.78
104.16.243.78

Docs for deleting the DNS record

Best Dikshith

Hi. Tell me please: can I use http without redirect to https?

P.S: I use site as websocket client. Client have to connect to websocket server. This server running on device in local network.
If site published as https, client have to connect to “wss://“ But I can’t use “wss://“ in local network, just “ws://“. Can I publish static site as “http”?

This comment has been deleted

    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.