1

I have a simple question (I think!). I have a hyperlink on my CF site that needs to be different if the site is being accessed through our intranet or out in the field, through our extranet.

How can I determine this in Coldfusion? I just need to change the hyperlink to https if the site is being accessed through our extranet.

Thank you

Neil Deeley
  • 57
  • 1
  • 9
  • 2
    Can you determine users of your intranet via their IP-address? If so, you can try to check that and modify the link. This UDF could be useful: http://cflib.org/udf/isIPInRange – Seybsen Mar 28 '14 at 10:43
  • 4
    I would argue that it's possibly better practice to force even intranet users to use the https, and just redirect the http->https for everyone. (I am aware of the limitations of using https, i.e for non-caching assets, but thought it was worth flagging). – Neokoenig Mar 28 '14 at 10:49
  • cgi.auth_user might help you with this. – Dan Bracuk Mar 28 '14 at 12:13
  • 1
    If you expect people on the extranet to be using https anyway, then you can use a protocol-neutral URL without any server-side code: link – barnyr Mar 28 '14 at 15:29

2 Answers2

5

I'd agree with Neokoenig - why give yourself the problem of choosing when to serve HTTP/HTTPS - unless you serve them on different domain names, and you don't want to pay for 2 SSL certificates.

Depends upon how you allow access to the intranet however - are you checking the IP address of the user for an internal IP to serve up intranet) or just detecting the URL that they used to access it (e.g. "intranet.company.com" or "extranet.company.com") for the application to understand what type of application it is serving up?

Either way, try dumping the CGI struct to see the various server variables available to you.

cf_phil
  • 76
  • 2
0

If your whole intranet is behind a proxy, CGI.REMOTE_ADD can you help in achieving this, because CGI.REMOTE_ADD will return address of proxy server and you can identify user with this.

CFML_Developer
  • 1,565
  • 7
  • 18