在 rails 中配置 loader.io [英] configuring loader.io in rails

查看:36
本文介绍了在 rails 中配置 loader.io的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用 heroku 中的 loader.io 插件来对服务器进行压力测试并优化服务器.我很难验证我的 URL.我已按照 loader.io 文档了解如何验证 URL,但我认为我没有正确执行此操作.文档建议了以下步骤.

I am trying to use the loader.io add on in heroku to stress test the servers and optimize the servers. I am having a really hard time verifying my URL. I have followed the loader.io documentation on how to verify the URL but I don't think I am doing it correctly. The documentation suggests the following steps.

1) 将验证令牌放在文件中或下载.我下载了 .txt 文件.但是文档说,文件应该上传到您服务器的根目录".我将文件放在根目录中,但出现以下错误.URL 返回了错误的响应代码 (404). 因此,我认为我没有把它放在正确的位置.

1) Place the verification token in a file or download it. I downloaded the .txt file. However the documentation says, "The file should be uploaded at the root of your server". I placed the file in the root directory but I get the following error. URL returned wrong response code (404). Therefore, I don't think I am placing it in the right place.

2) 将文件上传到您的服务器,以便可以通过以下网址之一访问它:

2) Upload the file to your server so it is accessible at one of the following URLs:

http://example..com/loaderio-28016b04fdb0ed4ea066**********a.txt

http://example..com/loaderio-28016b04fdb0ed4ea066**********a.html

http://example..com/loaderio-28016b04fdb0ed4ea066**********a/

我知道使这些链接可用的唯一方法是通过相关的控制器和操作.我制作了一个名为 loaders_controller 的控制器和带有 token 文件的 show 模板.命名路由指向加载器控制器并显示动作.这是我知道可以使以下路线可用的唯一方法.路由文件如下.

The only way I know to make these links available was through relevant controller and actions. I made a controller called loaders_controller and the show template with the token file in it. The named route points the loaders controller and show action. This is the only way I know I can make the following route available. The route file is given below.

get 'http://example..com/loaderio-28016b04fdb0ed4ea066**********a.txt' => 'loaders#show'

当我累了验证它时,它说找到了 URL 但令牌不存在.我认为这不是正确的做法.这条路线的形成对我来说似乎不合适.我认为问题是将文件放在根服务器中.我不确定我做错了什么.

When I tired to verify it, It said that the URL was found but the token was not present. I don't think this is the right way to do it. That route formation does not seem right to me. I think the problem is placing the file in the root servers. I am not sure what I am doing wrong.

推荐答案

将 .txt 文件放在 Rails 应用程序的 public 文件夹中.然后它将自动在根 URL 处提供,即 http://example.com/xxxxxx.txt.

Place the .txt file in the public folder of your Rails app. Then it will automatically be served at the root URL, i.e. http://example.com/xxxxxx.txt.

这篇关于在 rails 中配置 loader.io的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆