Redirect Parameter
Das Modul Redirect im IIS Internet Information Server hat einige Parameter welche Werte aus einer Webseite wiedergeben.
Es gibt leider keine Dokumentation, welcher Parameter was zurückgibt.
Deshalb habe ich einige Parameter unten in der Praxis am IIS ausgewertet
Betrifft: IIS, Redirect
Die Parameter werden aufgelistet unter
https://www.iis.net/learn/extensions/url-rewrite-module/url-rewrite-module-configuration-reference#UsingServerVars
"CACHE_URL",
"DOCUMENT_ROOT",
"HTTP_URL",
"HTTP_HOST",
"PATH_INFO",
"PATH_TRANSLATED",
"QUERY_STRING",
"REQUEST_FILENAME",
"REQUEST_URI",
"script_FILENAME",
"script_NAME",
"script_TRANSLATED",
"UNENCODED_URL",
"URL",
"URL_PATH_INFO",
"APP_POOL_ID",
"APPL_MD_PATH",
"APPL_PHYSICAL_PATH",
"GATEWAY_INTERFACE",
"SERVER_SOFTWARE",
"SSI_EXEC_DISABLED"
Test der Umleitung:
Die folgende Webseite soll per redirect im IIS weitergeleitet werden.
Die Einstellungen werden in der web.config eingetragen
URL vor der Umleitung
http://microsoft-programmierer.de/Details?d=1977
Dabei wird die Action untersucht.
HTTP_URL
<action type="Redirect" url="{HTTP_URL}" />
http://microsoft-programmierer.de/Details?d=1977&d=1977&d=1977........
DOCUMENT_ROOT
<action type="Rewrite" url="{DOCUMENT_ROOT}" />
http://www.microsoft-programmierer.de:80/
PATH_INFO
<action type="Rewrite" url="https:{PATH_INFO}" />
http://microsoft-programmierer.de:80/Details?d=1977
Physischer Pfad
|
C:\_Daten\_web\Programmierer\Details
|
QUERY_STRING
<action type="Rewrite" url="{QUERY_STRING}" />
HTTP-Fehler 404.0 - Not Found
http://microsoft-programmierer.de:80/d=1976?d=1976
Angeforderte URL
|
http://microsoft-programmierer.de:80/d=1976?d=1976
|
Physischer Pfad
|
C:\_Daten\_web\Programmierer\d=1976
|
REQUEST_URI
<action type="Rewrite" url="{REQUEST_URI}" />
Angeforderte URL
|
http://microsoft-programmierer.de:80/Details?d=1977&d=1977&d=1977&d=1977&d=1977&d=1977&d=1977..
|
Physischer Pfad
|
C:\_Daten\_web\Programmierer\Details
|
Edge und Explorer
Bei Umschalten von Rewrite auf Redirect
Angeforderte URL
http://microsoft-programmierer.de:80/?d=1977&d=1977..
URL_PATH_INFO
Result: ?d=1977
<action type="Redirect" url="https://{URL_PATH_INFO}" />
|
https:///?d=1977
APPL_MD_PATH
<action type="Redirect" url="https://{APPL_MD_PATH}" />
|
Result: https://lm/W3SVC/6/ROOT?d=1975
URL
<action type="Redirect" url="https://{URL}" />
|
Result: Details?d=1000
Echte Datei: Details.aspx
HTTP_HOST URL
https://{HTTP_HOST}{URL}
Result: Micrsosoft-programmierer.de/Details?d=10000
<rule name="http to https" stopProcessing="true">
<match url="(.*)" />
<conditions>
<add input="{HTTPS}" pattern="off" />
</conditions>
<action type="Redirect" url="https://{HTTP_HOST}{URL}" />
</rule>
|
Hinweis: dadurch wird richtigerweise die Domain plus die Webform-Seite auch ohne Extension .aspx plus die Abfrage ?x=1&y=2 weitergegeben
Ergebnis:
Die richtige Weiterleitung für Domains mit parametrisierten Webseiten sollte durch die Kombination
https://{HTTP_HOST}{URL} erfolgen
<rewrite>
<rules>
<!-- < Rule http_https > -->
<!-- *Redirect short pageURL to https
Example: http://microsoft-programmierer.de/Details?d=1977
-->
<rule name="http to https" stopProcessing="true">
<match url="(.*)" />
<conditions>
<add input="{HTTPS}" pattern="off" />
</conditions>
<action type="Redirect" url="https://{HTTP_HOST}{URL}" redirectType="Permanent" />
</rule>
<!-- </ Rule http_https > -->
</rules>
</rewrite>
|