Welcome! Log In Create A New Profile


Concat vars and text in map directive

Posted by alweiss 
Concat vars and text in map directive
May 29, 2017 08:07AM

I'm trying to use the map directive to rewrite the URL arg of my request to force https instead of http.

Example :
Request is : "GET https://www.mywebsite.com/?url=http://www.mysecondwebsite.com"
In this example, i'm trying to rewrite the http in the URL arg with https to obtain "GET https://www.mywebsite.com/?url=httpS://www.mysecondwebsite.com"

Using this configuration :

map $arg_url $arg_url_https {
default $arg_url;
"~*http:(?<suite>.+)" https:$suite;

But concat of "https: + $suite" just makes the text value "https:$suite" instead of interpreting the $suite value.
$suite works well when alone.

If you have any solution or another directive that could be used to force https in the url arg, it could be great.

This is part of a reverse proxy setup using the url arg in the proxy_pass directive to forward traffic.


Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 170
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