title: Swagger OpenAPI UI sending 403 response status for POST, PUT and DELETE Requests : Server hosted behind Nginx Proxy
body: <p><strong>Issue :</strong>
  Get request for Swagger UI openAPI is working , whereas other method types giving 403 error.</p>
  <p><strong>Dependency :</strong></p>
  <pre><code>&lt;dependency&gt;
          &lt;groupId&gt;org.springdoc&lt;/groupId&gt;
          &lt;artifactId&gt;springdoc-openapi-ui&lt;/artifactId&gt;
          &lt;version&gt;1.6.6&lt;/version&gt;
  &lt;/dependency&gt;
  </code></pre>
  <p><strong>Swagger Configuration :</strong></p>
  <pre><code>@Configuration
  @OpenAPIDefinition(servers = {
          @Server(url = &quot;https://hostname&quot;)
  })
  @SecurityScheme(name = auth, type = SecuritySchemeType.HTTP, bearerFormat = &quot;JWT&quot;, scheme = &quot;bearer&quot;)
  public class SwaggerConfig {
  }
  </code></pre>
  <p><strong>Security Configuration :</strong></p>
  <pre><code>public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
  @Override
  protected void configure(HttpSecurity http) throws Exception {
          http.cors().and().csrf().disable()
              .exceptionHandling().authenticationEntryPoint(unauthorizedHandler).and()
              .sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS).and()
              .authorizeRequests()
              .requestMatchers(PathRequest.toStaticResources().atCommonLocations()).permitAll()
              .anyRequest().authenticated();
  
          http.addFilterBefore(authenticationJwtTokenFilter(), UsernamePasswordAuthenticationFilter.class);
      }
      
      @Override
      public void configure(WebSecurity web) throws Exception {
          web.ignoring().antMatchers(&quot;/swagger-ui/**&quot;,&quot;/v3/api-docs/**&quot;);
          }
      }
  </code></pre>
  <p>We have also tried ignoring these paths : <code>/swagger-resources/** , /webjars/**</code> in WebSecurity, still its not working.</p>
  <p><a href="https://i.stack.imgur.com/x8oqk.png" rel="nofollow noreferrer">Post Request Error message 403</a></p>
  <p><strong>Original Edit</strong> : On some further research , found that's it may be because of the nginx proxy. Everything is working fine on my local but not working on other environments that are hosted behind the nginx proxy.</p>