redirect from a sinatra app on heroku - ruby

I have a very simple sinatra app (teaser page) running on Heroku on a custom domain. All is working well.
I also have a blog. It's running on a different heroku app under the standard heroku domain.
My question:
How can I make my sinatra app redirect 'www.mydomain.com/blog' to the other heroku app (e.g. the blog). Preferably the 'www.mydomain.com/blog' url is kept in the address bar of the user's browser..
I think i need some kind of rack redirect in my app, but i have no clue how to get it done..
Help is very much appreciated.
ps
I know you can put the blog at blog.mydomain.com, but that is not a solution in our case

You won't be able to redirect to the other heroku app and maintain www.mydomain.com/blog in the address bar. To do what you want in traditional hosting would require a reverse proxy to be setup which is not possible on Heroku - you would see .heroku.com.
If you're happy to redirect to the heroku.com - something like
get '/blog'
redirect 'http://<appname>.heroku.com'
end
If blog.mydomain.com isn't an option then the only option is to combine the sinatra app and the blog app into one app on www.mydomain.com and go from there.

Related

Google Domains Not Pointing to Correct Heroku App

I am trying to point my Google Domains domain name to Heroku, but am having a hard time. I previously had the domain forwarded to point to another website, but I have now followed these instructions to point it to my Heroku app.
The domain in question is www.lizbayardelle.com. The Heroku app I want it to is https://liz-bayardelle.herokuapp.com/. If I type heroku open in Terminal this is what comes up. However, if you go to the domain and the heroku app, the domain still shows the other website (to which it was initially forwarded), not the Heroku app.
Here are my Google Domains settings:
If you want it to point to liz-bayardelle.herokuapp.com, use that.
You've used www.liz-bayardelle.herokuapp.com. Visiting that URL displays Heroku's "no such app" page.
It turned out that the domain name was still "claimed" by the other Heroku app, so I had to log in to the one which had been forwarded on the Heroku console and delete the domain name. After I did this it could be added with heroku domains:add www.lizbayardelle.com and heroku domains:add lizbayardelle.com.

My heroku app redirects to another site

this week one of my client sent me an email saying that the url of the heroku's app was redirecting to another site myapp.com/index.cfm?fa=main.tradelogin. The name of this site is Pressgeek.com.
But if I use myapp.herokuapp.com it works fine. I checked my github repo to see if there was some redirect there but I didn't find any. I also checked the heroku's settings and there were ok.
I never had a problem like this, someone know what to do? Thanks

Adding Ghost blog to a React App Route instead of subdomain

I have been told to add a blog to a route for SEO purposes instead of subdomain. However I can't seem to figure out how to do this for a React app hosted on Firebase. Currently my Ghost bLog is hosted through heroku on my apps subdomain, I want to move it to an route. i.e instead of blog.myapp.com I want myapp.com/blog. How exactly can I achieve this, Using CNAME for the route(is that possible)?

Fortrbbit app domain change

So I am fairly new to laravel and especial to its deploying. I set up a fortrabbit application and got my website running so that's all good. The thing is though, the app url is not the one I wanted. I have an older website running without Laravel, and that is the url I want it to be hosted on. I have the ftp credentials for the old site but I have no clue how I can sort of clone the new Laravel site to the old one.
Briefly, I have a Laravel app running on insertname.eu1.frbit.net but I want it to be hosted on www.insertname.com which an older site is being hosted on for the time being.
Can anyone help me out? There must be a way to do this. Thanks alot!
The fortrabbit "App URL" is meant for testing/development/configuration and can't be changed. However you can route other domains to your App on fortrabbit. You do so by pointing the domain to the "App URL" via a CNAME and by registering the domain in the App settings in the Dashboard.

How to correctly set up development version of Facebook app on localhost for Facebook login?

I have made a Facebook app in Ruby (using Sinatra and Koala), deployed it on Heroku and sat up all the settings and it works that way, but now I have to debug some functionality and for that reason I need to run application from localhost (using foreman start).
I have read somewhere that I should make development version of my app and specify site url to localhost:[port_num] and I have done so.
The problem is when user(me) reach localhost:5000 and application redirects it to Facebook to get permissions (when Facebook login dialog should appears). At that point this error occurs:
App Not Set Up: The developers of this app have not set it up properly for Facebook Login.
I saw this issue but in my development version of app there is no status and review settings and I don't see how to make application alive.
How to set up my app for Facebook Login while it runs on localhost?
or
What is the proper way to run Facebook app from localhost to get full functionality?
The problem laid in Advanced settings in security section - development app "inherits" settings from base app so in Settings->Advanced->Security->Valid OAuth redirect URIs was initially url of my base app not my localhost:5000 and it causes a problem. One of solutions is to leave this field empty (and leave app open to redirect attacks) or to fill this field with your Site URL.
It seems that development version of an application can't be "alive".
To allow Facebook Login for users of your development app you should register them as testers under Roles tab.

Resources