We've moved discussions to Discord

Blog on same host as Rails app?

William Flanagan
I'm working on and about to relaunch a SaaS app using Jumpstart. Yay! 

I tried to build out a way to have the blog be with the Trix editor like we have in this forum. But, it pales in comparison to WordPress and its capabilities. 

I tried to do the whole "reverse proxy" where I hang the WordPress site off the "/blog" path of my Rails app. I can get the root working, but the interior Wordpress seems to want to rewrite to the hosted host name versus my app's main host name. 

So, this puts me back to that I have to have my app and my blog on separate host names. 

Has anyone worked out a better solution for this? I'd love to be able to use Wordpress as a CMS, but have it hosted off of my Rails app. 

Thoughts? 
Alan Matthews
Setting up a subdomain is probably what you're looking for: https://wordpress.com/support/domains/map-subdomain/
Justin Zimmerman
I'm guessing you have tried this based on the reverse proxy?
https://medium.com/@dipeshbatheja/how-to-setup-a-wordpress-blog-with-a-ruby-on-rails-web-app-d89b44bb95ec

Also would something like jekyll with stackbit? I don't know if that would be a middle ground between trix and wp.

Few other articles I found:
https://thoughtbot.com/blog/adding-a-blog-to-a-rails-app

https://buttercms.com/blog/when-youre-a-rails-developer-but-your-client-wants-wordpress


William Flanagan
Yes, I did things based on the medium article. 

I thought about mounting Jekyll. I also thought about using WordPress headless and adding some sort of Rails wrapper around it. But, I didn't try any of these options (yet). 

I looked at Butter too. Too much ownership for the lack of control IMO.  If I'm owning that much of the stack, then I might as well roll my own. 

I might just give up and move the app outside of the main domain. My goal was to have it all on my main domain.com so that everything points to the same paths and things like Mixpanel would be seamless. But, it might make more sense to have the SaaS app hosted at app.domain.com and leave WordPress for the main website. 

I have a team of people that are familiar with writing on WordPress. That UI makes it easier for them (and me, as one of them). Moving to writing posts in Markup or some sort of other editor isn't a great option. We also need to build landing pages pretty frequently. And, the marketing people aren't writing HTML/CSS natively. 

Thanks for the feedback everyone! It's helpful to get other people's perspectives. 
Marcos V Bohrer
Hey guys,

I use a solution on NGINX, before requesting on the Rails APP:

location ^~ /blog/ {
  proxy_pass http://blog.domain.com/;
  proxy_set_header Host $http_host;
  proxy_set_header X-Forwarded-Host $http_host;
  proxy_set_header X-Real-IP $remote_addr;
  proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  proxy_set_header X-Forwarded-Proto $scheme;
  proxy_redirect https://$proxy_host/ /blog/;
}

It works really well!

Regards,

Marcos
William Flanagan
We ended up getting it working using this write up.

https://medium.com/@technoblogueur/wordpress-blog-for-ruby-on-rails-the-configuration-that-worked-for-me-a8a7a989a68d

Notifications
You’re not receiving notifications from this thread.