在Play上强制执行SSL!骨架

编程入门 行业动态 更新时间:2024-10-25 15:21:32
本文介绍了在Play上强制执行SSL!骨架的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我目前正在使用Play! 1.2.2及其新的Netty客户端框架。

I'm currently using Play! 1.2.2 and its new Netty client framework.

我没有找到一种直接的方法来强制执行SSL,尽管可以让HTTP和HTTPS异步服务。有没有人与Play合作过!有一个直接的方法来执行SSL?不确定我是否需要创建重定向,或者是否可以在 conf 文件中快速解决此问题。

I haven't found a straightforward method to enforce SSL, although can get HTTP and HTTPS to serve asynchronously. Does anyone that's worked with Play! have a straightforward method of enforcing SSL? Not sure if I need to create redirects or if this can be solved quickly in a conf file.

推荐答案

有几种方法可以强制执行SSL。

There are a couple of ways to enforce SSL.

首先,您可以设置所有操作以使用 .secure()方法,例如

Firstly, you can set all your actions to use the .secure() method, for example

<a href="@{Application.index.secure()}">index page</a>

或者,可能最好的方法是通过前端HTTP服务器(如Apache)执行此操作,Nginx或Lighttpd。

Alternatively, and probably the best way, is to do this via a frontend HTTP server, such as Apache, Nginx or Lighttpd.

前端http服务器的想法是,您的应用程序在端口9000上运行,但无法从外部网络访问。 HTTP负责所有传入请求,并配置为仅接受HTTPS。 HTTPS由HTTP服务器处理,然后请求转发到Play。

The idea of the frontend http server, is that your application runs on port 9000, but is not accessible from the outside network. HTTP is responsible for all incoming requests, and is configured to only accept HTTPS. The HTTPS is handled by the HTTP server, and the request is then forwarded on to Play.

这使得整个Play应用程序正常工作,并且SSL被卸载另一个应用程序。

This leaves your entire Play application to work as normal, and the SSL is offloaded to another application.

这个方法可以应用于负载均衡器,而不是HTTP服务器,但我猜大多数人都会选择更便宜的替代方案HTTP服务器,除非在公司环境中运行。

This same method can be applied to a load balancer, rather than HTTP server, but I am guessing the majority of people will go with the far cheaper alternative of a HTTP server, unless running in a corporate environment.

更多推荐

在Play上强制执行SSL!骨架

本文发布于:2023-07-15 01:58:15,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1108353.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:骨架   强制执行   Play   SSL

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!