diff --git a/CHANGELOG b/CHANGELOG
index a9a8c00666d768c1e509601b28a90dab1d01e792..1d41a3505daf8802d1cd39b69e1434cd4ea6676f 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -29,6 +29,7 @@ v 6.7.0
   - Better API responses for access_levels (sponsored by O'Reilly Media)
   - Requires at least 2 unicorn workers
   - Requires gitlab-shell v1.9+
+  - Fix `/:username.keys` response content type (Dmitry Medvinsky)
 
 v 6.6.5
   - Added option to remove issue assignee on project issue page and issue edit page (Jason Blanchard)
diff --git a/app/controllers/profiles/keys_controller.rb b/app/controllers/profiles/keys_controller.rb
index b4f14e649e2ee2d293dca298e4373d1c99319369..6713cd7c8c742dc4f82d7e895548ffd2d61b00d3 100644
--- a/app/controllers/profiles/keys_controller.rb
+++ b/app/controllers/profiles/keys_controller.rb
@@ -41,7 +41,7 @@ class Profiles::KeysController < ApplicationController
       begin
         user = User.find_by_username(params[:username])
         if user.present?
-          render text: user.all_ssh_keys.join("\n")
+          render text: user.all_ssh_keys.join("\n"), content_type: "text/plain"
         else
           render_404 and return
         end
diff --git a/spec/controllers/profile_keys_controller_spec.rb b/spec/controllers/profile_keys_controller_spec.rb
index 121012d5d499cb935636b88d9c40d261c4ca6826..593d3e9eb56af120129125ae213e2e668838857c 100644
--- a/spec/controllers/profile_keys_controller_spec.rb
+++ b/spec/controllers/profile_keys_controller_spec.rb
@@ -24,6 +24,11 @@ describe Profiles::KeysController do
 
         expect(response.body).to eq("")
       end
+
+      it "should respond with text/plain content type" do
+        get :get_keys, username: user.username
+        expect(response.content_type).to eq("text/plain")
+      end
     end
 
     describe "user with keys" do
@@ -44,6 +49,11 @@ describe Profiles::KeysController do
         expect(response.body).not_to eq("")
         expect(response.body).to eq(user.all_ssh_keys.join("\n"))
       end
+
+      it "should respond with text/plain content type" do
+        get :get_keys, username: user.username
+        expect(response.content_type).to eq("text/plain")
+      end
     end
   end
 end