跨多个域名使用 Sinatra 会话变量?

发布于 2024-12-14 11:14:50 字数 297 浏览 6 评论 0原文

我正在构建一个 Sinatra 应用程序,它需要使用会话变量来完成一件非常具体的事情。当用户查看启用 SSL 的页面时,会设置会话变量。

我正在使用 Heroku 的搭载 SSL,因此 SSL url 类似于 https://myapp.heroku.com

但是,应用程序本身托管在我的 url myapp.com 上

有没有办法使我的会话变量(在 ssl / heroku 域名上设置)在我的域名上可供我的应用程序使用?

I'm building a Sinatra app which needs to use a session variable for one very specific thing. The session variable is set when the user is looking at an SSL enabled page.

I'm using Heroku's piggyback SSL, so the SSL url is something like https://myapp.heroku.com

However, the app itself is hosted at my url, myapp.com

Is there a way to make my session variable, which is set while on the ssl / heroku domain name, available to my app while while on my domain name?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

调妓 2024-12-21 11:14:50

不幸的是没有,因为 cookie 与域绑定。您需要做的是允许经过身份验证的用户使用 https://foo.heroku.com 域,并为登陆页面和页面保留您的好域名。其他未经验证的页面。

或者支付 20 美元购买 heroku 的 SSL 附加组件。

(我在 http://appkickstand.com 中遇到了这个确切的问题,我选择只处理记录的heroku url在用户中)

Unfortunately no, since the cookie is tied to the domain. What you'll have to do is either allow authenticated users to use the https://foo.heroku.com domain, and reserve your nice domain for the landing page & other unauthenticated pages.

That, or pay $20 for heroku's SSL add-on.

(I ran into this exact problem in http://appkickstand.com and I chose to just deal with the heroku url for logged in users)

青春有你 2024-12-21 11:14:50

您应该查找跨域 cookie 手册,查看

但我认为通过安全通道设置 cookie 并稍后通过原始 HTTP 传输(每个人都可以嗅探它)并没有太多理由。

You should look for cross-domain cookies manuals, check this.

But i don't see many reason in setting cookie through secured channel and transmitting it later via raw HTTP, where everyone could sniff it.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文