Deploy multiple apps to sub-paths

I’m wondering if it’s possible to deploy multiple apps to a single domain but to different paths on that domain.

An example:
Marketing app in Next.js → http://example.com/
Blog in Gatsby → http://example.com/blog/
App in Redwood → http://example.com/app/

Context:
I’ve been using Netlify and can setup the redirects using _redirect on the root site like this:
/app/* http://example-redwood-app.com/:splat 200.

The redirect works but the RedwoodJS app doesn’t work as expected because it attempts to load the resources (JS, CSS, images, etc.) from http://example.com/ instead of http://example-redwood-app.com/.

Question:
Can a public URL be set in RedwwodJS so that it uses absolute imports instead of relative imports?

1 Like

This would be totally possible with something like NGINX. you could combine them all into one application and use something like react-snap to pre-render the marketing pages.

1 Like

Do you know if it would be possible to do this just using Netlify and config?

I like the developer experience of Netlify and don’t want to lose that. I’m interested in having some structure where multiple services can be deployed individually with coarse-grained routing to them.

@Darth-Knoppix Hello, Seth, in addition to the approach proposed by @Chris, there is the alternative based on using the subdomains as “different paths” on your domain. So your setup would look like

Marketing app in Next.js → http://example.com
Blog in Gatsby → http://blog.example.com
App in Redwood → http://app.example.com

This is a bit simpler, as does not require NGINX based routing, and it still leaves you to use your original approach for additional branching.

2 Likes

Thanks @adriatic! I’ve used this approach in the past and I think it might be the best solution.

I was hoping to try out sub-paths for SEO purposes but subdomains will work perfectly with an app that’s not being indexed.

Thanks both of you for your help, I’m happy to be tinkering with ReswoodJS and getting great advice from the community.

No problem if you want to try Self Hosting and NGINX please get in touch

1 Like

Happy to be able to help, @Darth-Knoppix :grinning:

1 Like

The URL patterns in the path are repetitive; for each sub-model under the repository we keep having to repeat.

I hope this helped!