title: How to disable or remove Allow response header from OPTIONS?
body: <p>I have SecurityConfig class and I have added code to disable headers but I want to disable the 'Allow' response header. I have tried many different ways but no luck. How to add a custom header to disable?</p>
  <pre><code>        @Configuration
      @Slf4j
      public class SecurityConfiguration extends WebSecurityConfigurerAdapter {
          @Override
          protected void configure(HttpSecurity http) throws Exception
          {
              http.csrf().disable()
      
                      .authorizeRequests().anyRequest().authenticated()
                      .and()
                      .headers().xssProtection().disable()
                      .and().headers().frameOptions().disable()
                      .and().headers().contentTypeOptions().disable()
                      .and().headers().disable()
                      .httpBasic();
          
  }
  }
  </code></pre>
  <p>Rest Controller</p>
  <pre><code>{
  
  @RequestMapping(value = Constants.API_BASE_MAPPING + Constants.API_EVENT, method = RequestMethod.OPTIONS)
  public ResponseEntity&lt;?&gt; publishEventMessage() {
      return getResponseEntity();
  }
  
  private ResponseEntity&lt;?&gt; getResponseEntity() {
      return ResponseEntity
              .ok().contentType(MediaType.APPLICATION_JSON)
              .allow() // want to remove this 
              .build();
  }
  }
  </code></pre>
  <p><strong>Below is the response header from my <em>OPTIONS</em> API call</strong></p>
  <p><a href="https://i.stack.imgur.com/RNfDc.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/RNfDc.png" alt="enter image description here" /></a></p>