Heroku 的静态 IP 地址(不是 Proximo) [英] Static IP Address with Heroku (not Proximo)

查看:25
本文介绍了Heroku 的静态 IP 地址(不是 Proximo)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法为 Heroku 服务器获取一个静态 IP 地址?我正在尝试集成各种要求 IP 地址的 API.由于 Heroku 的服务器设置,您永远不会拥有一个具有静态 IP 的服务器 - 相反,您的 IP 是动态的.

Is there a way to get one Static IP address for a Heroku Server? I'm trying to integrate various API's which ask for an IP address. Because of Heroku's server setup, you never have one server with a static IP - instead your IP is dynamic.

我已经研究过像 Proximo 这样的附加组件,但这似乎是一个付费解决方案.有没有无需付费的静态 IP 的解决方案?

I've looked into add-ons like Proximo, however this appears to be a paid-for solution. Is there a solution where you have a static IP that you don't have to pay for?

推荐答案

你可以使用 QuotaGuard Static Heroku附加组件.

You can use QuotaGuard Static Heroku add-on.

QuotaGuard 可以通过命令行附加到 Heroku 应用程序:

QuotaGuard can be attached to a Heroku application via the command line:

$ heroku addons:add quotaguardstatic

安装后,应用程序应配置为与附加组件完全集成.当您注册时,您将获得一个唯一的用户名和密码,您可以在应用程序中配置代理服务时使用该用户名和密码

After installing, the application should be configured to fully integrate with the add-on. When you sign up you will be provided with a unique username and password that you can use when configuring your proxy service in your application

应用配置中将提供 QUOTAGUARDSTATIC_URL 设置,其中包含您应用于代理 API 请求的完整 URL.这可以使用下一个命令来确认:

A QUOTAGUARDSTATIC_URL setting will be available in the app configuration and will contain the full URL you should use to proxy your API requests. This can be confirmed using the next command:

$ heroku config:get QUOTAGUARDSTATIC_URL
http://user:pass@static.quotaguard.com:9293 

您通过此代理发出的所有请求都将向目标服务器显示,来自您注册时将分配的两个静态 IP 之一.

All requests that you make via this proxy will appear to the destination server to originate from one of the two static IPs you will be assigned when you sign up.

您可以使用适用于 Ruby 的简单 HTTP 和 REST 客户端来检测您的 IP:

You can use A simple HTTP and REST client for Ruby for detecting your IP:

$ gem install rest-client

接下来,您可以在 IRB 会话中运行以下示例,并验证返回的最终 IP 是您的两个静态 IP 之一.

Next, you can run the below example in an IRB session and verify that the final IP returned is one of your two static IPs.

$ irb

>require "rest-client"

>RestClient.proxy = 'http://user:pass@static.quotaguard.com:9293'

>res = RestClient.get("http://ip.jsontest.com")

就是这样:)

这篇关于Heroku 的静态 IP 地址(不是 Proximo)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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