I want to accept/deny requests depending on Http request custom headers. Is there any option available in both IIS and NGINX?
I think IIS has but NGINX??????
I want to accept/deny requests depending on Http request custom headers. Is there any option available in both IIS and NGINX?
I think IIS has but NGINX??????
URL rewrite inbound rule can deny request based on request header. For example, if your custom request header is AuthHeader. Then you only need to add a condition pattern for{HTTP_AuthHeader}.
The sample deny rule would looks like this.
<rule name="deny rule" stopProcessing="true">
<match url="(.*)" />
<conditions>
<add input="{HTTP_AuthHeader}" pattern="jokies" />
</conditions>
<action type="AbortRequest" />
</rule>
As you can see, IIS return 504 when the request header AuthHeader=jokies.
IIS return 200 if the AuthHeader doesn't match jokies
Of course, you can develop and inject your custom httpmodule to customize the request header filter.