我有一个安卓应用程序。尝试使用具有多个重定向的深度链接。
第一个。重定向-当我打开这个url ( https://www.tiny.com/op/abRh4
) Nginx将这个URL重定向到http://customdomain.com/internal
第二个重定向-此网址(http://customdomain.com/internal/abRh4
)将自动(通过API)重定向到https://customdomain.com?screen-no=25¬ification=show
(长url)
我终于想用https://customdomain.com?screen-no=25¬ification=show
打开深度链接了。但安卓用http://customdomain.com/internal/abRh4
打开它
有人建议如何使用深度链接处理多个重定向吗(我们可以通过nginx config将多个重定向处理为单个重定向吗)?
这是两个不同的服务器(第一个服务器-> Nginx重定向,第二个服务器api命中的-> )
nginx配置
server {
listen 443 ssl http2;
server_name www.tiny.com;
location /op {
add_header 'Access-Control-Allow-Origin' '*' always;
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS, PUT, DELETE';
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass https://customdomain.com/internal;
}
}
//this api will hit when we call http://customdomain.com/internal/abRh4
@GET
@Path("/{shortKey}")
@Produces({MediaType.TEXT_HTML})
public Response resolveShortUrl(@PathParam("shortKey") String shortUrlKey) {
UrlShortenerLogicHelper helper = new UrlShortenerLogicHelper();
try {
helper.openConnection();
URI url = new URI(helper.resolveShortUrl(shortUrlKey));
// return url like https://customdomain.com?screen-no=25¬ification=show
return Response.temporaryRedirect(url).build();
} catch(Exception e){}
}
发布于 2020-12-14 18:58:05
您可以使用在活动的意图过滤器中添加多个数据标记
<data android:host="www.test.com"
android:pathPrefix="/op/abRh4"
android:scheme="https" />
<data android:host="www.myOwnSite.com"
android:pathPrefix="/shorturl/abRh4"
android:scheme="https" />
https://stackoverflow.com/questions/65287441
复制相似问题