Traffic Splitting By IP Address on Google App Engine

柔情痞子 提交于 2020-01-04 04:25:07

问题


I'd like to direct traffic to different versions of Google App Engine code based on a set list of known IP Addresses.

For example, if an incoming request is from an IP Address on a given list, then traffic is directed to version 1. If not, then version 2.

Is there a way to do this from the admin console or deployment configuration?

The end goal is to grant access to extra features when the site is accessed from an approved IP Address. If I can't do this from the admin console, then I plan to get the IP Address during the user's login process, and set their security role based on IP.


回答1:


There's not a way within the admin console or deployment process. However, if you do cookie-based traffic splitting, you can set the cookie yourself (based on the incoming IP address, or another value you desire). The value is stored in GOOGAPPUID and the value you'd want to use is described in the documentation, and varies depending on the number of versions you're splitting between and the respective levels of traffic you'd like to send to each version.

If you don't want to do traffic splitting for users not on a given list of IPs, you should make sure to explicitly set the cookie for all users. Otherwise, App Engine will provide the value (and send some users to both versions) by default.



来源:https://stackoverflow.com/questions/15032531/traffic-splitting-by-ip-address-on-google-app-engine

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!