on 01-18-2016 5:05 PM
Hi experts,
I try to forward an http request to https but there the query string is lost.
Any ideas how to solve this?
Thats how the rule looks.
if %{SERVER_PROTOCOL} !stricmp "https"
RegRedirectUrl /(.*) https://<domain>/$1
If I enter the url http://<domain>/test?parameter=value I get forwarded to https://<domain>/test
So the URL-Parameter gets lost.
I've already tried [QSAPPEND] at the end, but with no effect.
Kind regards
A great Thx to everybody for help.
I think the answer is too easy to see it on the 1st view.
After a few tries I got the idea - it is in the header fields.
Just add %{QUERY_STRING} at the end is the solution, this will add the querystring.
To make it to a query-string it is required to add also a ? before.
So the solution for forwarding an old host to a new one combined with an http(s) redirect looks like this:
if %{HTTP_HOST} regimatch host_old.* [and]
if %{SERVER_PROTOCOL} !stricmp "https"
RegRedirectUrl /(.*) https://host_new.company.com/$1?%{QUERY_STRING}
However, I made two statements, to avoid making an URL with just an ? at the end (=query string is empty).
Therefore it looks like this: (1st if query string is available, 2nd if not)
if %{HTTP_HOST} regimatch host_old.* [and]
if %{QUERY_STRING} !stricmp "" [and]
if %{SERVER_PROTOCOL} !stricmp "https"
RegRedirectUrl /(.*) https://host_new.company.com/$1?%{QUERY_STRING}
if %{HTTP_HOST} regimatch host_old.* [and]
if %{SERVER_PROTOCOL} !stricmp "https"
RegRedirectUrl /(.*) https://host_new.company.com/$1
I know icm/http/redirect_## is also a possible solution, but this one is much more mighty and you can make the statements and much more dynamical.
Kind regards and thx again
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi, Query parameters are not preserved when using RegRedirectUrl and options [qsappend][qsreplace] are only available for the RegRewriteUrl/RegIRewriteUrl actions. The options for this scenario are: 1. Use parameter icm/HTTP/redirect_. 2. Use RegRewriteUrl or RegIRewriteUrl. Thanks. Jim
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello,
I'm not sure whether this would work...
But you could try:
if %{SERVER_PROTOCOL} !stricmp "https"
RegRewriteUrl (.*) https://hostname:port$1
Another option would be to use the parameter icm/HTTP/redirect_X to switch the initial connection to HTTPS already.
icm/HTTP/redirect_X = PREFIX=/, FROMPROT=http, PROT=https, HOST=<Web Disp. host>
Thus, all further communication will be in HTTPS and there would be no need for your rewrite rule.
In fact, this sounds more secure. Otherwise, the query string will come unencrypted the first time, and if you want to use HTTPS is because you want to protect it .
Regards,
Isaías
Hi,
Can you please reproduce the issue and paste dev_webdisp trace file here for our analysis.
best regards,
Manjunath
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
As mentioned by Jim you can use parameter icm/HTTP/redirect_x . you can find documentation here:
icm/HTTP/redirect_&lt;xx&gt; - Administration - SAP Library
best regards,
Manjunath Hanmantgad
User | Count |
---|---|
86 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.