I’d like routes like /wiki and /forum to pass traffic through to another website (on another host), so it looks to users like they’re on the same domain. I also have a number of redirects, e.g. /xyz redirects to a separate domain to maintain old links.

I currently implement these all in nginx, and “everything else” is proxied to my rails app.

In the DO app platform world, I assume I should use the rails router for redirects, but what about proxying? Should I use rack proxy or something? Or is there some way to control routing at a higher layer in the app platform (e.g. via some ingress container)

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.

×
1 answer

You can control the routes for components within your app on the “Components” tab the “HTTP Routes” section. We don’t currently offer the ability to configure arbitrary redirects, though it is functionality we are considering. You should be able to make these redirects easily within the rails routing layer.

As far as reverse proxying, it’s unlikely we’ll add functionality for proxying outside the App Platform directly. I’m not familiar with the Rack::Proxy, but it looks like it could work. You could also run nginx as a service within your application using a Dockerfile. We have an example nginx Dockerfile and configuration available in our sample repos at https://github.com/digitalocean/sample-nginx. To avoid unnecessary load, I recommend keeping your existing routes for the rails application, and add new routes to nginx just for the parts you want to proxy.

Submit an Answer