Configure StoreFront 3 and IIS to display the current server name on the pages.
Following a question from Tony in the comments of this article: StoreFront 3 optimizations.
When load balancing Citrix StoreFront, it is important to always know which current StoreFront server we are connect to.
Unfortunately there is no built-in feature in Citrix StoreFront to do that, so we have to play with Microsoft IIS and the StoreFront configuration.
Follow the procedure below to display the server name on your Citrix StoreFront web pages.
IIS Configuration
Connect to your StoreFront server and open IIS console (inetmgr.exe). Select your StoreFront website (Default Web Site by default).
In the Features view, select HTTP response headers.
Select Add, and then type :
- Name: SF-ServerName
- Value: SF02
Select OK.
IIS is now configured.
Note: Make sure to repeat the operation on all your servers.
StoreFront configuration
Go to C:\inetpub\wwwroot\Citrix\<StoreName>Web\Custom and open style.css.
Add the following code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
.customAuthFooter { font-size:12px; color:Black; bottom:10px; text-align: center; } #customBottom { text-align:center; font-size:12px; color:Black; padding:10px; position:static; } |
Go to C:\inetpub\wwwroot\Citrix\<StoreName>Web\Custom and open script.js.
Add the following code:
1 2 3 4 5 6 7 8 |
var req = new XMLHttpRequest(); req.open('GET', document.location, false); req.send(null); var servername = req.getResponseHeader('SF-ServerName'); $('.customAuthFooter').html(servername); $('#customBottom').html(servername); |
If needed, restart IIS with the following command:
1 |
iisreset /noforce |
Testing
Connect to your StoreFront website, you should see the server name at the bottom of the page.
Logon to the webpage, you should also see the server name at the bottom of the applications page.
You can play with the CSS to display the server name wherever you want.
Note: Make sure to propagate the changes in the StoreFront configuration on all servers.
Hi Nicolas. Thanks for this. I believe script.css should be script.js. Also, the changes to the custom files can be pushed to the other servers by doing Propagate Changes, but the Response Header needs to be configured separately on each server.
Thanks ! I’ve updated the article.
Hi Nicolas.
Great article.
This works fine for me, it’s THE much appropriate change than any other solutions found at all.
Keep going 🙂
glad you liked it ! 🙂
Thanks for this great article! Much Appreciated!
has this been tested on SF 3.5
yes !
In PROD on my side !
Donovan,
How did you get it to work on SF 3.5. I have 2 SF servers running 3.5 and could not get to work at all. Would you mind shed some light on how you did your. Also how do you deal with the actual server name, since propagating will overwrite it though.
Thank you,
Vinh Le
Update, I finally got it working now. Thank you all.
Hi Nicolas,
Great Article. How do you prevent the script running on the Receiver client?
Thanks
I too would like to know how to prevent the script running on the Receiver client. Especially 4.4, you will get a javascript error pop-up.
Nicolas – This is exactly what I was looking for. Thank you very much!
Thanks Tony !
This doesn’t work for Receiver client for Windows. How to display StoreFront server name on Receiver client ?
On the Receiver 14.4.0.8014 client I’m seeing a script error. How do you prevent it from running on the receiver client? Or better yet how do you get it to run and display the footer correctly in the receiver 14.4.0.8014 client.
Did you ever get it to not have a script error? I’m running into the same problem
+1 On Web its totally fine but i too receiving Script error for Receiver. please let me know the configuration for Receiver ?
Receiver for Windows (also the Receivers for Mac and Linux) is slightly more complicated because the Web UI is actually running off a cache on the local disk, rather than running straight off the web server. Here’s an updated code sample which should work for both the web page and the Receiver clients. It uses a Citrix API (CTXS.ExtensionAPI.proxyRequest()) to make the AJAX call to the server. I’m making the request to an arbitrary file on the server (custom/style.css) – you could easily create an empty file somewhere on the server to reduce the data being downloaded, if you wanted.
CTXS.Extensions.afterDisplayHomeScreen = function () {
CTXS.ExtensionAPI.proxyRequest({
url: ‘custom/style.css’,
success: function (data, textStatus, xmlHttpRequest) {
// Extract HTTP header values from the response
var servername = xmlHttpRequest.getResponseHeader(‘SF-ServerName’);
$(‘.customAuthFooter’).html(servername);
$(‘#customBottom’).html(servername);
}
});
};
You have a great idea using HTTP headers. It appears this does not work on the Citrix Receiver 14.4.0.8014 client as it produces script errors. How can you get it to not run on the Citrix 14.4.0.8014 client or better yet run correctly?
Does this also work for SF 3.5 and the classic experience?
thanks this was great!
You have a great idea using HTTP headers. It appears this does not work on the Citrix Receiver 14.4.0.8014 client as it produces script errors. How can you get it to not run on the Citrix 14.4.0.8014 client or better yet run correctly?
Hi,
I have StoreFront 3.5 and tried to perform the customizations however the footer is not appearing.
Hi Vinh can you share how you got yours working in the end?
Thanks.
Harold,
In my case, I have 2 StoreFront servers but the WEB.CONFIG on one of them did not get updated. Make sure they are both the same if you have 2 or more servers.
Vinh,
Hi Vinh,
Thanks for getting back to me. I also have 2 SF servers. WEB.CONFIG … did I miss something from the steps above?
Harold
Harold,
Not sure if that would make any different though, but I actually added/modified the “HTTP Response Headers” from my Receiver Web instead of the one from “Default Web Site”. Because if you look at the screen shot it said “Local” in columm “Entry Type”. Also run IISReset or reboot may help too.
Vinh,
Harold,
Sad to say but I just made that change in Default Web Site and it did not make any different.
Vinh,
Harold,
I just check both of my “Style.css” & ” Script.js” and realize something different from what posted here.
for my script.js I added these listed below.
/* BEGINNING – Display Server Name */
var req = new XMLHttpRequest();
req.open(‘GET’, document.location, false);
req.send(null);
var servername = req.getResponseHeader(‘SF-ServerName’);
$(‘.customAuthFooter’).html(servername);
/* END – Display Server Name */
and for my style.css
/* BEGINNING – Display Server Name */
.customAuthFooter
{
font-size:12px;
color:Black;
bottom:10px;
text-align: center;
}
/* END – Display Server Name */
Let me know if that help,
Vinh,
Hi Vinh,
Thanks for getting back to me. Unfortunately the value is still not showing in the footer. Will try to dig more into it later. Not a show stopper now and thanks for your tips.
Harold
Wholesale Oakley twoface sunglasses opal and black light grey good deals on eyeglasses outlet
I think this article is very helpful for us,it has solved my problem,thanks!
Has anyone figured out a way around the Script error when using the Receiver client?
Works great with Storefront 3.6 but still the same script error with custom/script.js for the client.
I modified script.js a little so it is not executing and not showing ServerName on Receiver Client (which is not critical in my case as I need it to be displayed in StoreFront)
if (CTXS.Device.isNativeClient()) {
// Do not show SF-ServerName
} else {
var req = new XMLHttpRequest();
req.open(‘GET’, document.location, false);
req.send(null);
var servername = req.getResponseHeader(‘SF-ServerName’);
$(‘.customAuthFooter’).html(servername);
$(‘#customBottom’).html(servername);
}
Did a quick test and works fine for me
Hello,
I am using StoreFront 3.8 on Server 2016 and I am unable to get this to work. I have tried everything I know of in my limited knowledge and can’t seem to figure out why. Is there something I might be missing?
Hi Chris, I just did this today an Server 2016 wit SF3.8 and it worked instant.
I appreciate you trying. I still cannot get it to work. I wonder if one of my other customizations may be inhibiting this functionality.
Thanks
This method is a good alternative but it requires manual IIS settings on each SF servers and if you are building the SF server again then these have to be documented or remember to be set.
we have a different method that will Dynamically query the servername and print it in the footer once a user logs in. it doesnt work on the receiver client due to Java calls and html codes.
Hi Guys, I am using SF 2.6.0
If someone can provide me steps (Step by step) to have the Storefront servername displayed at the bottom of Citrix receiver.
Server Name Display is not working in StoreFront 3.11
@Serg – adding that if else statement did the trick for me and getting rid of that jscript error with the native receiver client on SF 3.11
Thanks for the great article Nicolas.I tried on SF 3.12 and it works instantly on firefox but not in I.E !!! any pointers?