在生产配置中使用localhost [英] Using localhost in production config

查看:64
本文介绍了在生产配置中使用localhost的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我在这里有问题.我被要求支持和维护一个现成的应用程序(Web).我已经在测试环境和生产环境中设置了该应用程序.它具有一个包含Web应用程序URL的配置文件.我认为它使用它来指向本地Web服务.

现在,有人建议将这个URL设为"localhost"会很好-这样配置文件在所有环境中都是相同的.如果我已经使用了实际的URL test.tinyurl.com和prod.tinyurl.com,我们最终将为每个环境使用不同的配置文件.

现在,如果这是我自己的Web应用程序,我知道解决该问题的方法.我会使用某种machine.config,注册表中的环境令牌等.但是,不幸的是,这是第三方软件.

我想我现在的真正问题是-在生产配置文件中可以使用localhost吗?这样做有什么弊端?

我首先想到了安全风险.任何人都可以详细说明在生产配置中使用本地主机吗?

谢谢

关于

Hi all,

I have a problem here. There is an off-the-shelf application (Web) that I have been asked to support and maintain. I''ve set up the application in a testing environment, and in production. It has a configuration file that contains the url of the web application. I think it uses it to point back to a local web service.

Now, the thing is someone suggested that it would be good to have this url to be "localhost" - that way the configuration file is the same in all environments. Should I have used the actual url test.tinyurl.com and prod.tinyurl.com, we end up having different config file for each environment.

Now, I know ways to get around this if it was my own web applications. I would use some sort of machine.config, environment tokens in registry, etc.. But, unfortunately this is a third party software.

I guess now my real question is - Is it okay to use localhost in production config files? What are the CONS of doing this?

Security risk first comes in my mind. Can anyone elaborate more on using localhost in production config?

Thanks

Regards

推荐答案

使用localhost的问题是在Javascript或客户端上使用localhost时,它将调用查看器的localhost.它的真正含义是调用服务器.

来吧.还有其他不在配置文件中使用本地主机的原因吗?
The problem with using localhost is when localhost is used in Javascript or anything on the client-side, it will call the viewer''s localhost.. when what it really meant to do is call the server..

Come on guys.. Any other reasons not to use localhost in your config files?


这篇关于在生产配置中使用localhost的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆