WSO2 Micro Integrator 自动跟随重定向
WSO2 Micro Integrator auto follow redirects
我正在使用 WSO2 Micro Integrator v1.2.0
今天我遇到了一个关于 HTTP 状态代码 307/301 的问题。
当目标端点响应 http 代码 307 或 301 时,微集成器立即响应而不是遵循重定向。
[2021-08-25 10:34:40,722] DEBUG {wire} - HTTPS-Sender I/O dispatcher-2 << "GET /destination_endpoint HTTP/1.1[\r][\n]"
[2021-08-25 10:34:40,722] DEBUG {wire} - HTTPS-Sender I/O dispatcher-2 << "Authorization: Basic Y3VjX3FsZHQ6Y3VjX3FsZHQ=[\r][\n]"
[2021-08-25 10:34:40,722] DEBUG {wire} - HTTPS-Sender I/O dispatcher-2 << "Accept: text/plain, application/json, application/x-jackson-smile, application/cbor, application/*+json, */*[\r][\n]"
[2021-08-25 10:34:40,722] DEBUG {wire} - HTTPS-Sender I/O dispatcher-2 << "Accept-Encoding: gzip,deflate[\r][\n]"
[2021-08-25 10:34:40,722] DEBUG {wire} - HTTPS-Sender I/O dispatcher-2 << "request_id: a16b98a9-8efa-4ff1-9060-83a82f9c4786[\r][\n]"
[2021-08-25 10:34:40,722] DEBUG {wire} - HTTPS-Sender I/O dispatcher-2 << "Host: destination_host[\r][\n]"
[2021-08-25 10:34:40,722] DEBUG {wire} - HTTPS-Sender I/O dispatcher-2 << "Connection: Keep-Alive[\r][\n]"
[2021-08-25 10:34:40,722] DEBUG {wire} - HTTPS-Sender I/O dispatcher-2 << "User-Agent: Synapse-PT-HttpComponents-NIO[\r][\n]"
[2021-08-25 10:34:40,722] DEBUG {wire} - HTTPS-Sender I/O dispatcher-2 << "[\r][\n]"
[2021-08-25 10:34:40,754] DEBUG {wire} - HTTPS-Sender I/O dispatcher-2 >> "HTTP/1.1 307 Temporary Redirect[\r][\n]"
[2021-08-25 10:34:40,754] DEBUG {wire} - HTTPS-Sender I/O dispatcher-2 >> "Server: nginx[\r][\n]"
[2021-08-25 10:34:40,754] DEBUG {wire} - HTTPS-Sender I/O dispatcher-2 >> "Date: Wed, 25 Aug 2021 04:32:43 GMT[\r][\n]"
[2021-08-25 10:34:40,754] DEBUG {wire} - HTTPS-Sender I/O dispatcher-2 >> "Content-Type: text/html[\r][\n]"
[2021-08-25 10:34:40,754] DEBUG {wire} - HTTPS-Sender I/O dispatcher-2 >> "Content-Length: 180[\r][\n]"
[2021-08-25 10:34:40,754] DEBUG {wire} - HTTPS-Sender I/O dispatcher-2 >> "Connection: keep-alive[\r][\n]"
[2021-08-25 10:34:40,754] DEBUG {wire} - HTTPS-Sender I/O dispatcher-2 >> "Set-Cookie: BPC=625112d03351499b4eb22e1d9286a164; path=/[\r][\n]"
[2021-08-25 10:34:40,754] DEBUG {wire} - HTTPS-Sender I/O dispatcher-2 >> "Location: https://redirects_url/[\r][\n]"
[2021-08-25 10:34:40,754] DEBUG {wire} - HTTPS-Sender I/O dispatcher-2 >> "Strict-Transport-Security: max-age=15768000 always; includeSubdomains; preload[\r][\n]"
[2021-08-25 10:34:40,769] DEBUG {wire} - HTTPS-Sender I/O dispatcher-2 >> "X-Frame-Options: DENY[\r][\n]"
[2021-08-25 10:34:40,785] DEBUG {wire} - HTTPS-Sender I/O dispatcher-2 >> "X-Content-Type-Options: nosniff[\r][\n]"
[2021-08-25 10:34:40,785] DEBUG {wire} - HTTPS-Sender I/O dispatcher-2 >> "[\r][\n]"
[2021-08-25 10:34:40,785] DEBUG {wire} - HTTPS-Sender I/O dispatcher-2 >> "<html>[\r][\n]"
[2021-08-25 10:34:40,785] DEBUG {wire} - HTTPS-Sender I/O dispatcher-2 >> "<head><title>307 Temporary Redirect</title></head>[\r][\n]"
[2021-08-25 10:34:40,785] DEBUG {wire} - HTTPS-Sender I/O dispatcher-2 >> "<body bgcolor="white">[\r][\n]"
[2021-08-25 10:34:40,785] DEBUG {wire} - HTTPS-Sender I/O dispatcher-2 >> "<center><h1>307 Temporary Redirect</h1></center>[\r][\n]"
[2021-08-25 10:34:40,785] DEBUG {wire} - HTTPS-Sender I/O dispatcher-2 >> "<hr><center>nginx</center>[\r][\n]"
[2021-08-25 10:34:40,785] DEBUG {wire} - HTTPS-Sender I/O dispatcher-2 >> "</body>[\r][\n]"
[2021-08-25 10:34:40,785] DEBUG {wire} - HTTPS-Sender I/O dispatcher-2 >> "</html>[\r][\n]"
我在互联网上搜索了所有内容,但仍然没有任何在微集成器中自动跟随重定向的解决方案。
有人知道如何配置 wso2 微型集成器自动跟随带有 http 代码 307 或 301 的重定向吗?
默认情况下,它不处理重定向。一种选择是通过查看 HTTP 代码在微集成器中处理该问题。
<filter source="$axis2:HTTP_SC" regex="301">
<then>
<log level="custom">
<property name="----Working on 301--------" value="TRUE"/>
</log>
<property name="locationvalue" expression="$trp:Location"/>
// call the endpoint in the location header.
</then>
<else>
<log level="custom">
<property name="---------------respose----------------------" value="Execute other scenarios"/>
</log>
</else>
</filter>
我正在使用 WSO2 Micro Integrator v1.2.0 今天我遇到了一个关于 HTTP 状态代码 307/301 的问题。 当目标端点响应 http 代码 307 或 301 时,微集成器立即响应而不是遵循重定向。
[2021-08-25 10:34:40,722] DEBUG {wire} - HTTPS-Sender I/O dispatcher-2 << "GET /destination_endpoint HTTP/1.1[\r][\n]"
[2021-08-25 10:34:40,722] DEBUG {wire} - HTTPS-Sender I/O dispatcher-2 << "Authorization: Basic Y3VjX3FsZHQ6Y3VjX3FsZHQ=[\r][\n]"
[2021-08-25 10:34:40,722] DEBUG {wire} - HTTPS-Sender I/O dispatcher-2 << "Accept: text/plain, application/json, application/x-jackson-smile, application/cbor, application/*+json, */*[\r][\n]"
[2021-08-25 10:34:40,722] DEBUG {wire} - HTTPS-Sender I/O dispatcher-2 << "Accept-Encoding: gzip,deflate[\r][\n]"
[2021-08-25 10:34:40,722] DEBUG {wire} - HTTPS-Sender I/O dispatcher-2 << "request_id: a16b98a9-8efa-4ff1-9060-83a82f9c4786[\r][\n]"
[2021-08-25 10:34:40,722] DEBUG {wire} - HTTPS-Sender I/O dispatcher-2 << "Host: destination_host[\r][\n]"
[2021-08-25 10:34:40,722] DEBUG {wire} - HTTPS-Sender I/O dispatcher-2 << "Connection: Keep-Alive[\r][\n]"
[2021-08-25 10:34:40,722] DEBUG {wire} - HTTPS-Sender I/O dispatcher-2 << "User-Agent: Synapse-PT-HttpComponents-NIO[\r][\n]"
[2021-08-25 10:34:40,722] DEBUG {wire} - HTTPS-Sender I/O dispatcher-2 << "[\r][\n]"
[2021-08-25 10:34:40,754] DEBUG {wire} - HTTPS-Sender I/O dispatcher-2 >> "HTTP/1.1 307 Temporary Redirect[\r][\n]"
[2021-08-25 10:34:40,754] DEBUG {wire} - HTTPS-Sender I/O dispatcher-2 >> "Server: nginx[\r][\n]"
[2021-08-25 10:34:40,754] DEBUG {wire} - HTTPS-Sender I/O dispatcher-2 >> "Date: Wed, 25 Aug 2021 04:32:43 GMT[\r][\n]"
[2021-08-25 10:34:40,754] DEBUG {wire} - HTTPS-Sender I/O dispatcher-2 >> "Content-Type: text/html[\r][\n]"
[2021-08-25 10:34:40,754] DEBUG {wire} - HTTPS-Sender I/O dispatcher-2 >> "Content-Length: 180[\r][\n]"
[2021-08-25 10:34:40,754] DEBUG {wire} - HTTPS-Sender I/O dispatcher-2 >> "Connection: keep-alive[\r][\n]"
[2021-08-25 10:34:40,754] DEBUG {wire} - HTTPS-Sender I/O dispatcher-2 >> "Set-Cookie: BPC=625112d03351499b4eb22e1d9286a164; path=/[\r][\n]"
[2021-08-25 10:34:40,754] DEBUG {wire} - HTTPS-Sender I/O dispatcher-2 >> "Location: https://redirects_url/[\r][\n]"
[2021-08-25 10:34:40,754] DEBUG {wire} - HTTPS-Sender I/O dispatcher-2 >> "Strict-Transport-Security: max-age=15768000 always; includeSubdomains; preload[\r][\n]"
[2021-08-25 10:34:40,769] DEBUG {wire} - HTTPS-Sender I/O dispatcher-2 >> "X-Frame-Options: DENY[\r][\n]"
[2021-08-25 10:34:40,785] DEBUG {wire} - HTTPS-Sender I/O dispatcher-2 >> "X-Content-Type-Options: nosniff[\r][\n]"
[2021-08-25 10:34:40,785] DEBUG {wire} - HTTPS-Sender I/O dispatcher-2 >> "[\r][\n]"
[2021-08-25 10:34:40,785] DEBUG {wire} - HTTPS-Sender I/O dispatcher-2 >> "<html>[\r][\n]"
[2021-08-25 10:34:40,785] DEBUG {wire} - HTTPS-Sender I/O dispatcher-2 >> "<head><title>307 Temporary Redirect</title></head>[\r][\n]"
[2021-08-25 10:34:40,785] DEBUG {wire} - HTTPS-Sender I/O dispatcher-2 >> "<body bgcolor="white">[\r][\n]"
[2021-08-25 10:34:40,785] DEBUG {wire} - HTTPS-Sender I/O dispatcher-2 >> "<center><h1>307 Temporary Redirect</h1></center>[\r][\n]"
[2021-08-25 10:34:40,785] DEBUG {wire} - HTTPS-Sender I/O dispatcher-2 >> "<hr><center>nginx</center>[\r][\n]"
[2021-08-25 10:34:40,785] DEBUG {wire} - HTTPS-Sender I/O dispatcher-2 >> "</body>[\r][\n]"
[2021-08-25 10:34:40,785] DEBUG {wire} - HTTPS-Sender I/O dispatcher-2 >> "</html>[\r][\n]"
我在互联网上搜索了所有内容,但仍然没有任何在微集成器中自动跟随重定向的解决方案。
有人知道如何配置 wso2 微型集成器自动跟随带有 http 代码 307 或 301 的重定向吗?
默认情况下,它不处理重定向。一种选择是通过查看 HTTP 代码在微集成器中处理该问题。
<filter source="$axis2:HTTP_SC" regex="301">
<then>
<log level="custom">
<property name="----Working on 301--------" value="TRUE"/>
</log>
<property name="locationvalue" expression="$trp:Location"/>
// call the endpoint in the location header.
</then>
<else>
<log level="custom">
<property name="---------------respose----------------------" value="Execute other scenarios"/>
</log>
</else>
</filter>