I have IIS 8 installed on Windows Server 2012 R2
but as soon as in web.config i specify
<match url="(.*)" />
when set <match url=""(.*)"" />
no errors and http to https doesn't work.
CodePudding user response:
Can you access the service link https://XXX/ws/Services.asmx
successfully? It seems that after redirecting to HTTPS, it can't be accessed. Please try set AllowAutoRedirect
property to true
.
If it still doesn't work, You can also try the following:
IIS reverse proxy and URL rewriting work together to achieve https redirection.
You need to install ARR module on the web platform installer. You can see the Application Request Routing Cache module at the service node after the installation is complete, double-click to open it, select Server Proxy Settings
, check Enable proxy
, do not need to modify the content, of course, you can modify it according to your needs. Click Apply to complete the request routing settings. Finally set up rewrite rule in the site:
You can refer to some of my suggestions, try to solve this problem.
CodePudding user response:
Found an answer, no need to install Applicarion request routing, just needed to modify URL rewrite rule:
<rule name="Http to HTTPS" enabled="false" stopProcessing="true">
<match url="(.*)" negate="false" />
<conditions logicalGrouping="MatchAll" trackAllCaptures="false">
<add input="{HTTPS}" pattern="^OFF$" />
</conditions>
<action type="Redirect" url="https://{HTTP_HOST}/{R:1}" redirectType="Found" />
</rule>
Website relies on the webservice and was configured to talk to it (the /ws/Services.asmx url) on http://, so when the website made a call to the webservice with http:// the request got caught by the https redirect rule which sent it a redirect response header (301 found message). So the original POST call got a 301 response to redirect it to the https:// url which was not what the website expected so the webservice call (the POST) essentially got lost and it was as if the webservice was unreachable causing the error message to appear.
The url to the webservice was configurable in the web.config file so the website is now calling the webservice directly using https:// and no ARR was needed