跨多个域名使用 Sinatra 会话变量?
我正在构建一个 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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
不幸的是没有,因为 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)
您应该查找跨域 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.