使用自定义 Headers 通过 F5 重定向 SendGrid Webhook 事件
Redirect SendGrid Webhook Events with an F5 using Custom Headers
通过 SendGrid 发送电子邮件时,我发送的是自定义 header。有没有办法配置 webhooks 以从 SendGrid 返回自定义 header,以便可以轻松编写 F5 iRule 以根据此自定义 header 中的值重定向流量。我知道我可以使用 .addCustomArgs(...) 来 return 自定义数据,但我想要 header.
中的自定义数据
var client = new SendGridClient("API_KEY");
var from = new EmailAddress("test@example.com", "Example User");
var subject = "Testing with SendGrid API";
var to = new EmailAddress("joe@test.com", "Example User");
var plainTextContent = "Test Content";
var htmlContent = "<strong>Testing with HTML content</strong>";
var msg = MailHelper.CreateSingleEmail(from, to, subject, plainTextContent, htmlContent);
var identifiers = new Dictionary<String, String>();
identifiers["application"] = "APP_NAME_GOES_HERE";
identifiers["resource"] = "RESOURCE_NAME_GOES_HERE";
msg.AddHeaders(identifiers);
var response = await client.SendEmailAsync(msg);
此处为 Twilio SendGrid 开发人员布道师。
恐怕您无法设置 headers 让 SendGrid 事件 Webhook 发回。自定义参数作为 JSON body.
的一部分发送
我以前没有使用过 F5 iRule,但您似乎可以在 iRule 中解析和使用请求的 JSON body。根据this post, you can use iRules LX to deal with the JSON using JavaScript.
或者好像可以结合HTTP::collect
with an HTTP_REQUEST_DATA
block来收集和请求body做事。
通过 SendGrid 发送电子邮件时,我发送的是自定义 header。有没有办法配置 webhooks 以从 SendGrid 返回自定义 header,以便可以轻松编写 F5 iRule 以根据此自定义 header 中的值重定向流量。我知道我可以使用 .addCustomArgs(...) 来 return 自定义数据,但我想要 header.
中的自定义数据var client = new SendGridClient("API_KEY");
var from = new EmailAddress("test@example.com", "Example User");
var subject = "Testing with SendGrid API";
var to = new EmailAddress("joe@test.com", "Example User");
var plainTextContent = "Test Content";
var htmlContent = "<strong>Testing with HTML content</strong>";
var msg = MailHelper.CreateSingleEmail(from, to, subject, plainTextContent, htmlContent);
var identifiers = new Dictionary<String, String>();
identifiers["application"] = "APP_NAME_GOES_HERE";
identifiers["resource"] = "RESOURCE_NAME_GOES_HERE";
msg.AddHeaders(identifiers);
var response = await client.SendEmailAsync(msg);
此处为 Twilio SendGrid 开发人员布道师。
恐怕您无法设置 headers 让 SendGrid 事件 Webhook 发回。自定义参数作为 JSON body.
的一部分发送我以前没有使用过 F5 iRule,但您似乎可以在 iRule 中解析和使用请求的 JSON body。根据this post, you can use iRules LX to deal with the JSON using JavaScript.
或者好像可以结合HTTP::collect
with an HTTP_REQUEST_DATA
block来收集和请求body做事。