You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@trafficserver.apache.org by Stas Obydionnov <st...@gmail.com> on 2013/05/29 11:39:32 UTC

Dynamic HTML messages sent to client

Hi all,
We are implementing product which requires to display different HTML
messages to different users.
I know there are customisable pages like described here
http://trafficserver.apache.org/docs/trunk/admin/traffic-server-error-messages/index.en.html#HTMLMessagesSentClients.
And I know there is a possibility to define different file per language.
What I need is something different. I need an option to select the page
according to transaction information available in plugin.
For example, if request comes particular IP I send one error page, if from
another IP, I send another page.
If there is a hook which I can hook and provide the ATS the page I want to
be sent to client, it will be good solution. Even if I would have ability
to redirect the client to the server which will display the error message
it would be good.

Thank you.
Stas.

Re: Dynamic HTML messages sent to client

Posted by James Peach <jp...@apache.org>.
On May 29, 2013, at 2:39 AM, Stas Obydionnov <st...@gmail.com> wrote:

> Hi all,
> We are implementing product which requires to display different HTML messages to different users.
> I know there are customisable pages like described here http://trafficserver.apache.org/docs/trunk/admin/traffic-server-error-messages/index.en.html#HTMLMessagesSentClients. And I know there is a possibility to define different file per language.
> What I need is something different. I need an option to select the page according to transaction information available in plugin.
> For example, if request comes particular IP I send one error page, if from another IP, I send another page.

You probably want:

  tsapi void TSHttpTxnErrorBodySet(TSHttpTxn txnp, char* buf, int buflength, char* mimetype);

There's also:

  tsapi void TSHttpTxnSetHttpRetBody(TSHttpTxn txnp, const char* body_msg, int plain_msg);

At one point I played with these and I recall that they worked from a remap plugin, but not from the hook I was calling them in my global plugin. Let us know how you go and we can fix up any issues you run into.


> If there is a hook which I can hook and provide the ATS the page I want to be sent to client, it will be good solution. Even if I would have ability to redirect the client to the server which will display the error message it would be good.
> 
> Thank you.
> Stas.