首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >通过多个重定向处理深度链接

通过多个重定向处理深度链接
EN

Stack Overflow用户
提问于 2020-12-14 18:34:41
回答 1查看 209关注 0票数 0

我有一个安卓应用程序。尝试使用具有多个重定向的深度链接。

第一个。重定向-当我打开这个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&notification=show (长url)

我终于想用https://customdomain.com?screen-no=25&notification=show打开深度链接了。但安卓用http://customdomain.com/internal/abRh4打开它

有人建议如何使用深度链接处理多个重定向吗(我们可以通过nginx config将多个重定向处理为单个重定向吗)?

这是两个不同的服务器(第一个服务器-> Nginx重定向,第二个服务器api命中的-> )

nginx配置

代码语言:javascript
运行
复制
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&notification=show
            return Response.temporaryRedirect(url).build();
        } catch(Exception e){}
    }
EN

回答 1

Stack Overflow用户

发布于 2020-12-14 18:58:05

您可以使用在活动的意图过滤器中添加多个数据标记

代码语言:javascript
运行
复制
<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" />
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/65287441

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档