I'm trying to integrate openx into an Ruby on Rails 2 application and I'm deploying my rails application on the root of my server like 'http://mydomain.com/' so i put the openx folder in the public so it'd load in 'http://mydomain.com/openx/www/admin/' hut i'm getting this error
No route matches "/openx/www/admin/"
Should i add a custom route on my routes.rb file?
No matter what, I'd suggest setting up vhosts so that you can have oxadmin.mydomain.com go to /path/to/openx/www/admin and have oxdelivery.mydomain.com go to /path/to/openx/www/delivery and oximages.mydomain.com go to /path/to/openx/www/images
OX was designed so all files which should be public are in the 'www' folder - setting it up like above keeps only the www files publicly available while also separating your admin, delivery, and image domains
Related
I've created a website using Rails 6 on Heroku. I need to drop a file into /.well-known/ but I've no idea where that might be.
I created a folder with that name in the root of the project and checked it in to git, but it doesn't show up there.
It seems that I should use a route to do this, but I don't have a handle on the syntax to use. I basically need to expose a /.well-known/longhashedstring.txt to a 3rd party service for about a minute.
See above answer from Sharj. Put your .well-known folder in /public for Rails 6 and all is good.
I'm building an App (Rails 4 + Angular) which the admin area will be an Angular app. I'm following (loosely) this tutorial.
I've created a client directory in the root directory (I'm using a Gulp generator) so I can develop, unit test the applications separately but when deploying, both apps will work together, the Rails app will provide the API plus traditional routes in a Rails app and the Angular app will be an admin interface to create content and manage a series of services (business logic).
I'd like to compile the Angular app to the public folder and create a route in Rails /admin that will redirect to the public folder. How can I do this in Rails 4?
I have a Heroku hosted Rails app that has reached the 300MB limit for the slug size and can no push to Heroku. To fix this issue, I've setup an AWS S3 account and want to redirect the assets being requested from my Rails app to the new S3 location. The Rails app is basically just serving JSON files that point to the static assets using a relative URL. An iOS app using the Rails JSON then has a hardcoded domain URL, and appends the path to the resources to that domain and requests assets it needs.
I want to update my Heroku app and change my asset locations without requiring an update to the iOS app in order to change the asset domain. So, I need to redirect static asset requests from the Rails app to the AWS server.
In my git repo, I've ignored the assets in the public folder that I've moved to the AWS server. The asset files are present on my local machine, but are not part of the git repo when uploaded to Heroku.
So far I've tried changing the config.action_controller.asset_host which does not seem to work since these are static assets and are being returned by the web server before Rails gets it.
I tried using routes rules to redirect to a different domain, but these routes never seem to be captured. The static files appear to be returned before the Rails app has a chance to handle the request.
I've tried using the rack-rewrite gem to try and redirect my assets to a different domain with the following in `initializers/rack_rewrite.rb:
require 'rack/rewrite'
AppNamespace::Application.config.middleware.insert_before(Rack::Lock, Rack::Rewrite) do
r301 %r{/images(.*)}, 'http://my-subdomain.amazonaws.com/images$1'
end
This doesn't seem to work either and it always just returns the static files.
So far I've been trying for hours to figure out the proper way to handle this situation. I'm not a Rails developer by trade, I build iOS apps, so please let me know if I'm going about this the wrong way or completely missed the "right" way of doing this.
I solved this using routes and the 'rails_serve_static_assets'. I had to move the local images out of the public folder in order to avoid Nginx from returning the images before hitting the Rails app. The route ended up like so:
match '/images/(*path)', :to => redirect { |params, request|
"#{Rails.configuration.assets.aws_url}#{request.path}"
}
Hi I have a built out Ember app which works with a single rails backend. I would like to now have several other Ember apps working with rails but i am not sure how to make it work. I am using Oauth, devise and rolify to send logged in users to different ember apps.
Why don't you put all of your ember apps in separate folders inside the Rail's public folder? For example, if you have 2 ember apps, admin and publisher, your folder structure can be something like this:
/app
/public
/admin
/index.html --> ember app
/publisher
/index.html --> ember app
You'll need to define a couple of routes in config/routes.rb, one for admin and one for publisher so that when someone goes to a URL that matches your ember app, the correct file gets served. You can try something like this:
get '/admin/*path' => redirect('/admin/')
get '/publisher/*path' => redirect('/publisher/')
Note that while the above route examples will work, you'll want to do a rewrite instead of a redirect.
Doing it this way will future proof your solution in case you migrate your apps to Ember CLI in the future. With Ember CLI, you can just build your ember apps into the public/admin and public/publisher folders in the future.
I have couple of generated pages, which I want rails to route to.
Example, in my rails root, I have a folder, 'generated' which has lot of generated web pages (static html, with their own stylesheets and images relative to their path).
I want to tell rails that allow them to routable, like how apache, nginx allows you to do it.
This is only for development mode, btw. I know this could be done very easily using nginx/apache in production.
Option 1.
you can put those "generated" folders in your public directory & just link to it within your views
Option 2.
Move those "generated" folders in app/views directly, add a StaticPage controller & render them. see this example