Modify http response code

2014-12-10 Thread Dennis Jacobfeuerborn
Hi,
is there a way to modify the http code of a response? Right now I use a
backup server to deliver a static maintenance page but I want it to be
delivered with a 503 code instead of 200. Is there a way to modify the
response code like this?

Regards,
  Dennis



Re: Modify http response code

2014-12-10 Thread Baptiste
On Wed, Dec 10, 2014 at 2:55 PM, Dennis Jacobfeuerborn
denni...@conversis.de wrote:
 Hi,
 is there a way to modify the http code of a response? Right now I use a
 backup server to deliver a static maintenance page but I want it to be
 delivered with a 503 code instead of 200. Is there a way to modify the
 response code like this?

 Regards,
   Dennis



Hi Dennis,

Yes you can using rspirep.

Baptiste



Re: Modify http response code

2014-12-10 Thread Philipp

Am 10.12.2014 14:55 schrieb Dennis Jacobfeuerborn:

Hi,
is there a way to modify the http code of a response? Right now I use a
backup server to deliver a static maintenance page but I want it to be
delivered with a 503 code instead of 200. Is there a way to modify the
response code like this?


I did this approach, e.g. using a dedicated backend instead of 'backup'.
Shortened snippet, but you'd get the idea.

frontend man
 default_backend man-maint
 acl www1nb nbsrv(man-www1) gt 0
 use_backend man-www1 if www1 www1nb

backend man-maint
 rsprep ^HTTP/1.1\ 200\ OK HTTP/1.0\ 503\ Service\ Unavailable
 server local_maint localhost:8001



Re: Modify http response code

2014-12-10 Thread Baptiste
On Wed, Dec 10, 2014 at 3:06 PM, Philipp
e1c1bac6253dc54a1e89ddc046585...@posteo.net wrote:
 Am 10.12.2014 14:55 schrieb Dennis Jacobfeuerborn:

 Hi,
 is there a way to modify the http code of a response? Right now I use a
 backup server to deliver a static maintenance page but I want it to be
 delivered with a 503 code instead of 200. Is there a way to modify the
 response code like this?


 I did this approach, e.g. using a dedicated backend instead of 'backup'.
 Shortened snippet, but you'd get the idea.

 frontend man
  default_backend man-maint
  acl www1nb nbsrv(man-www1) gt 0
  use_backend man-www1 if www1 www1nb

 backend man-maint
  rsprep ^HTTP/1.1\ 200\ OK HTTP/1.0\ 503\ Service\ Unavailable
  server local_maint localhost:8001


I would rather use:
  rspirep ^HTTP/1\..\ 200\ OK HTTP/1.0\ 503\ Service\
Unavailable\r\nConnection:\ Close

Baptiste