简体   繁体   English

手机上的Ajax POST请求:跨域还是WS转发?

[英]Ajax POST request on mobile : cross domain or WS forwarding?

I have a Play! 我有戏! 2.2 Java server on Heroku generating my form templates and another on EC2 to save infos in DB. 2.2 Heroku上的Java服务器生成我的表单模板,而EC2上的另一个则在数据库中保存信息。

(Dont ask why such an architecture ... my client really want's like that : he wants to deploy easily it's template changes with heroku but he couldn't put all the server and DB on it ). (不要问为什么这样的架构...我的客户真的想要这样:他想用heroku轻松部署它的模板更改,但是他不能将所有服务器和数据库都放在上面)。

Well. 好。 I thought about an Ajax Cross Domain request to submit the form directly to the EC2 server, but .. this is a mobile website, and I'm not sure Cross Domain is a good idea in this case. 我想到了Ajax跨域请求,将表单直接提交到EC2服务器,但是..这是一个移动网站,在这种情况下,我不确定跨域是一个好主意。

So i'm trying to forward my form submission from play heroku to play ec2 as easily as possible, not having to bind each parameter manually (dynamicform...) 因此,我正在尝试从play heroku转发我的表单提交,以尽可能轻松地播放ec2,而不必手动绑定每个参数(dynamicform ...)

Any advices ? 有什么建议吗?


My mobile app : 我的手机应用程序:

  • one form to create a "topic" 一种创建“主题”的表格
  • another to post a geolocated message in the topic. 另一个在主题中发布地理位置消息。
  • a template to display the topic and a google map. 显示主题的模板和google map。

EDIT : thinking to other solutions 编辑:思考其他解决方案

In other words, I have a fat website on EC2 with obsolete code and a small mobile one on heroku. 换句话说,我在EC2上有一个繁琐的网站,上面有过时的代码,在heroku上有一个小型的移动网站。 The fat one has my user table and some cool features like thread/comments. 胖子有我的用户表和一些很酷的功能,例如线程/注释。

I wonder if : 我怀疑是否 :

  • I merge the small code into the big one (to access those features). 我将小代码合并为大代码(以访问这些功能)。
  • Or make requests between the two servers with Ajax cross domain to post forms from mobile 或在具有Ajax跨域的两台服务器之间发出请求,以从移动设备发布表单
  • Or if I re-code only what I need on the small one, which could even take really much time than the first features. 或者,如果我只在小型应用程序上重新编码,那可能比第一个功能花费很多时间。

This sounds awfully confusing. 这听起来很混乱。 Having your database on a remote server will probably require you to run on top of SSL (which affects performance). 将数据库放置在远程服务器上可能会要求您在SSL之上运行(这会影响性能)。 Also having 2 play applications adds to the mambo jambo. 也有2个播放应用程序增加了曼波舞的趣味。

Have you just tried to use RDS as your database, just simply enable SSL and allow access to your heroku app ? 您是否刚刚尝试将RDS用作数据库,是否仅启用SSL并允许访问heroku应用程序?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM