Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

This is driving me bananas.

We have multiple REST servers. We set a custom header in IIS so we can identify which server is responding to a request. Each server passes its name in this header.

On the IIS 6 servers, this works %100. On IIS7, it works great... but after a few hrs or days, my custom header setting in IIS disappears.

I have custom bindings, and ssl, and all kinds of good stuff configured.

What could cause IIS to drop my custom header setting?

System is:

  • Win2008
  • IIS 7.0
  • Header name: X-APPSERVER-NAME
  • Using the inet manager gui application to make the change
    Just adding the header with the default value for local or server based setting

The sequence of events is:

  1. Go into IIS manager
  2. Go to your web site
  3. Add a custom header
  4. Test from fiddler, the new custom header is visible in the response
  5. Exit IIS Mgr,
  6. log out of windows
  7. Go home
  8. Go to bed
  9. Wake up
  10. Eat breakfast
  11. Go to work
  12. Discover the custom header is gone!
  13. Repeat Steps 1-12 a few times
  14. Post the issue here on server fault

thanks!!

share|improve this question
    
IIS 7.0 or 7.5 (Win 2008 or 2008R2)? What is the header name? Do you use the inetmgr console or do you edit the config files directly? Have you added the header on a single web site, or on server-level (local or inherited)? –  Mathias R. Jessen Jul 15 '12 at 10:49
    
Added detail to the OP –  samsmith Jul 15 '12 at 15:10
    
Is there a proxy or load balancer sitting in front of this server? –  Kev Jul 15 '12 at 22:23
    
@Kev Yes, there is. But that would affect what I see in the response... not make changes to the iis config itself! –  samsmith Jul 16 '12 at 1:46
    
Are you saying the header is being physically deleted from IIS config? i.e. you have to keep going in to IIS Manager (or use appcmd.exe or some such config script) to put it back? –  Kev Jul 16 '12 at 1:49
show 2 more comments

1 Answer

By default, this gets written in your web.config file when adding a header with default values (local) in IIS7:

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
        <httpProtocol>
            <customHeaders>
                <add name="X-Test" value="Test" />
            </customHeaders>
        </httpProtocol>
    </system.webServer>
</configuration>

I believe IIS6 does it differently.

Do you have some kind of auto-deploy/auto-update of your website, which would overwrite such a changed web.config? (And thus deletes the custom header?)

Then either change your source web.config, or add the header on IIS Level (Root node) which is not written to the applications web.config

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.