Question

How should I implement proxying and redirects on the app platform?

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)


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.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

Hello, just thought I’d check in a year or so later to see if there’s been any improvement on this in the App Platform?

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.