Merge branch 'master' into 4194-keep-logging
[arvados.git] / services / api / app / controllers / static_controller.rb
index f64e9a41fadabb3b94047f40a6238b6b50861c5b..d624ea8c35983dfe745610a195b40c6418a53434 100644 (file)
@@ -1,10 +1,23 @@
 class StaticController < ApplicationController
+  respond_to :json, :html
 
   skip_before_filter :find_object_by_uuid
-  skip_before_filter :require_auth_scope_all, :only => [ :home, :login_failure ]
+  skip_before_filter :render_404_if_no_object
+  skip_before_filter :require_auth_scope, :only => [ :home, :login_failure ]
 
   def home
-    redirect_to Rails.configuration.workbench_address
+    respond_to do |f|
+      f.html do
+        if Rails.configuration.workbench_address
+          redirect_to Rails.configuration.workbench_address
+        else
+          render_not_found "Oops, this is an API endpoint. You probably want to point your browser to an Arvados Workbench site instead."
+        end
+      end
+      f.json do
+        render_not_found "Path not found."
+      end
+    end
   end
 
 end