Deploy a JavaScript app JavaScript apps built for production are a collection of static files. You can deploy them to any web server, and then configure that web server to be SPA-aware.
Ensure that you configure all paths to redirect to index.html
because your framework handles the routing. You also need to force HTTPS.
Heroku One easy way to deploy your JavaScript app to production with Okta is with Heroku.
To begin, install the Heroku CLI (opens new window) and run heroku login
.
You can deploy your JavaScript application to Heroku in five steps:
Run heroku create
.
Add the Git remote that's created as a remote for your project.
Create a static.json
file with the configuration for secure headers and redirect all HTTP requests to HTTPS. Make sure to change dist/<your-app>
to have the location of your app's built files.
For static.json
to be read, you have to use the Heroku static buildpack (opens new window) . The static buildpack runs npm run build
by default. For Angular, add --prod
to the build script.
Commit your changes, add the Node.js + static buildpack, and deploy your app.
If your branch isn't named master
, run:
You can't sign in to your app until you add your Heroku app's URLs to your Sign-in redirect URIs , Sign-out redirect URIs , and Trusted Origins on Okta.
See Angular Deployment with a Side of Spring Boot (opens new window) for deploying to Heroku, Firebase, Netlify, and AWS S3.
Docker You can package your JavaScript app with Docker. See the Angular + Docker with a Big Hug from Spring Boot (opens new window) blog post. Specifically, see the Create a Docker Container for Your Angular App (opens new window) section.
Okta also has a tutorial that details how to package a React app with Docker (opens new window) .