Kentico 9管理员URL更改并锁定到http://localhost.



我正在通读文档,没有看到我在寻找什么。

这个新的构建将在临时-->生产设置上运行。在prod方面,我希望管理员登录只能用于本地主机。通过这种方式,您必须登录到服务器才能访问管理面板。

我假设我需要对web.config进行调整,但我如何确保只有http://localhost/作品

尝试在web服务器上安装URL Rewrite,并将以下重写规则添加到web.configsystem.webServer部分。这将导致IIS拦截/admin下的任何URL,如果不在服务器本地的URL上,则返回403。您可能还需要调整URL匹配或为其他Kentico管理路径添加其他规则(例如,CMAdministratoron.aspx等)。

<rewrite>
<rules>
<rule name="Block Remote Access to Admin" stopProcessing="true" patternSyntax="ECMAScript" enabled="true">
<match url="admin(/|$)" ignoreCase="true" />
<conditions logicalGrouping="MatchAll">
<add input="{REMOTE_ADDR}" pattern="localhost" ignoreCase="true" negate="true" />
<add input="{REMOTE_ADDR}" pattern="127.0.0.1" negate="true" />
<add input="{REMOTE_ADDR}" pattern="::1" negate="true" />
</conditions>
<action type="CustomResponse" statusCode="403" statusDescription="Forbidden" statusReason="Access to this URL is restricted"/>
</rule>
<rules>
</rewrite>

在Admin/CMSAdministration.aspx.cs中添加自定义代码以仅授予localhost权限。

最新更新