Welcome! Log In Create A New Profile

Advanced

Return different code if return code is 400

Posted by cicovy 
Return different code if return code is 400
August 01, 2013 05:05AM
Hi,

Does anyone know if I can return a different code if I get the returned code 400 - Bad Request?

I want to configure a section of my server in a way that if the code is 400, actually to send 401 or 403?

Thanks!



Edited 1 time(s). Last edit at 08/01/2013 05:05AM by cicovy.
Re: Return different code if return code is 400
August 01, 2013 06:29AM
Hello,

I found the solution myself. Actually, nginx was returning 400 in error log, but the internal returned code was 495. So I added above all locations in server {} the following:

error_page 495 =401 /mypage.html;

All works as expected, hopefully I did not mess something else on the way.

Thanks!
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 120
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 500 on July 15, 2024
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready