我应该使用自定义标头还是 useragent 标头将设备信息发送到服务器 [英] Should I use custom headers or useragent header to send device informations to the server

查看:21
本文介绍了我应该使用自定义标头还是 useragent 标头将设备信息发送到服务器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

每次我向服务器发送 API 请求时,我都希望发送设备类型和操作系统版本等信息(来自我的移动应用).我的第一个想法是使用用户代理,但我想知道使用X-deviceType"或/和X-osVersion"等自定义 http 标头是否有任何好处.

Every time I send a API request to my server I want send informations like device type and OS version (from my mobile app). My first thought is to use User Agent but I wonder if there's any benefits to use custom http header like "X-deviceType" or/and "X-osVersion" instead.

推荐答案

我正在使用 X-Device HTTP 标头.

I am using the X-Device HTTP Header.

在大多数情况下运行良好,但是我注意到来自代理后面的一些请求似乎正在从该标头中剥离数据.

Works well for the most part, however I have noticed that some requests from behind a proxy seem to be stripping the data from that header.

这篇关于我应该使用自定义标头还是 useragent 标头将设备信息发送到服务器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆