Quantcast
Channel: Nginx Forum - Other discussion
Viewing all articles
Browse latest Browse all 972

Trying to normalize apps that pass either header or querystring based value

$
0
0
I'm trying to normalize the way a couple applications access a web resource and have come up with what is a very ugly solution and am curious as to if anyone else have a better, cleaner one. In this case, one app will pass the needed information in a header value while the other passes the same data, but as part of the querystring.

Here is a config snip:

[code]
http {

map $http_x_platform_version:$args $temp_x_platform_version {
"~^(?<temp>[^:]+):" $temp;
"~(^|&)X-Platform-Version=(?<temp>[^&]+)" $temp;
default "Unknown";
}

server {
set $http_x_platform_version $temp_x_platform_version;
}
}
[/code]

This allows me to reference $http_x_platform_version as needed and pass it around, is there a better way to achieve this, short of the application creators changing things on their end of course.

Note: Forgive the formatting as I did not see a way to make a code block here.

Viewing all articles
Browse latest Browse all 972

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>