Photo by David Hellmann from Unsplash

The Problem

So here's a scenario I'm sure many of us are familiar with: you're working on a SaaS product, and naturally there are multiple components involved:

  • a landing page, hosted somewhere like Landen, Carrd, LeadPages, etc.
  • your app's frontend, hosted on a CDN like surge.sh, netlify, etc.
  • your app's backend, hosted on Heroku, AWS, DigitalOcean, etc.
  • a blog or support docs explaining your product

But the problem is you want all of these components to be under your domain name, myproduct.com. What do you do?

The usual solution is subdomains: have myproduct.com go to the landing page, app.myproduct.com goes to the app frontend, which talks to api.myproduct.com, blog.myproduct.com, support.myproduct.com, you get the idea.

This approach works, but it has some issues. For one, it hurts your SEO. It also requires you get wildcard SSL certificates to support HTTPS on all of these subdomains. Not to mention all of the CORS and cookie issues you'll run into.

It'd be nice if you could have myproduct.com/app, myproduct.com/api, myproduct.com/blog right? But how do you do that? What we need is a reverse proxy!

Reverse Proxy

"A reverse proxy (or gateway) appears to the client just like an ordinary web server. The client makes ordinary requests for content, and reverse proxy decides where to send those requests and returns the content." - Apache Docs

There are several options for this: HAProxy, NGINX, Apache (aka httpd), Caddy. I particularly like this guide of how to set up HAProxy with Docker and Heroku. Another good one is this guide on how to set up NGINX as a reverse proxy.

Something Better

If all of this seems like a lot of trouble, you're not alone. I thought so too, and that's why I'm making Routepath. The goal is simplicity: choose which paths go where, point your domain at routepath.app, and you're done. Some additional things Routepath will handle for you include:

  • Automatic SSL cert retrieval and renewal
  • Automatic redirect to HTTPS
  • Middleware (CORS, Authentication, Custom Headers, etc.)
  • Metrics
  • And more (if you have a feature you'd find useful, let me know)

Routepath isn't launched yet, but if you're interested, you can sign up for updates and an early look by visiting routepath.app or by following @routepathapp on Twitter.