Welcome! Log In Create A New Profile

Advanced

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

Posted by EldonMcGuinness 
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.
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 101
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready