Wcf webservice and URL redirection using https

I researched and tried to solve this problem for several days without success.

I have a WCF web service deployed in IIS 8 on a Windows 2012 server.

during development, I use the full service URL to make service calls.

Example:

http://myserver.com/appservices/service1.svc/getdata 

But now I need to do the following:

  • I have a domain on godaddy, say somedomain.com , and I want to use the services.somedomain.com subdomain to use instead of the full URL. So I want to have something like services.somedomain.com/getdatainstead of writing the full url above. I could not do this. I tried to configure URL forwarding on Godaddy for the services subdomain to go to http://myserver.com/appservices/service1.svc, this works in the browser, but when using it in a mobile application or through a violinist, I get an error 301. (I tried with or without masking). Is there any way to achieve this?

  • I need to get an SSL certificate. My question is here, for which domain should I get it? I can get it for somedomain.com or for the subdomain services.somedomain.com or possibly for the source domain myserver.com . I lost a little here and I do not want to buy and ssl certificate on the wrong one.

To give you a general idea of ​​the final result that I hope to get, I need to have the following:

somedomain.com points to a site deployed on iis

services.somedomain.com points to a wcf web service deployed on the same iis and it will be used for services that will be called from android / iphone. And it must have SSL certificate

somedomain.com godaddy

/, .

+4
4

.

-, , Windows 2012, somedomain.com , .. . , SSL, . , SSL , , .

, Url Rewrite, . ? - , - - ( 301 ). - URL- , .

Url Rewriting, Web.config:

<system.webServer>
  <rewrite>
    <rules>
      <!-- My rules -->
    </rules>
  </rewrite>
</system.webServer>

( , services.somedomain.com ).

  • , http://services.somedomain.com/appservices/service1.svc/getdata http://services.somedomain.com/getdata.

    <rule name="SubDomainAppService" stopProcessing="true">
        <match url="(.*)" />
        <conditions>
            <add input="{HTTP_HOST}" pattern="^services\.somedomain\.com$" />
        </conditions>
        <action type="Rewrite" url="{HTTPS}services.somedomain.com/appservices/service1.svc/{R:1}" />
    </rule>  
    

    , services.somedomain.com/getdata, URL- services.somedomain.com/appservices/service1.svc/getdata. / HTTPS.

  • SSL , , . HTTP HTTPS.

    <rule name="Redirect to HTTPS" stopProcessing="true">
      <match url="(.*)" />
      <conditions>
        <add input="{HTTPS}" pattern="^OFF$" />
      </conditions>
      <action type="Redirect" url="https://{HTTP_HOST}/{R:1}" redirectType="Permanent" />
    </rule>
    

URL - , . , , :


:

DNS, SSL- , DNSimple. " Troy Hunt, . SSL- DNSimple .

* , , . API.

+3

, -:

  • somedomain.com :
    • : http, : somedomain.com, : 80
    • : http, : www.somedomain.com, : 80
  • services.somedomain.com :
    • : https, : services.somedomain.com, : 443
    • : http, : services.somedomain.com, : 80

( HTTP- https).

SSL:

SSL- SSL IIS. SSL () , . , foo.com, bar.com. , , ( UCC ).

, SSL IIS7 appcmd.

:

- ( www-, - webservice). , - - , webservice .

URL:

service1.svc URL-, URL-. URL Rewrite module. IIS . web.config, services.somedomain.com:

<system.webServer>
    <!-- other rules -->
    <rewrite>
        <rules>
            <rule name="http to https" stopProcessing="true">
                <match url="(.*)" />
                <conditions>
                    <add input="{HTTPS}" pattern="^OFF$" />
                </conditions>
                <action type="Redirect" url="https://{HTTP_HOST}/{R:1}" redirectType="Temporary" />
            </rule>
            <rule name="everything to service1.svc">
                <match url="(.*)" />
                <conditions>
                    <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
                    <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
                </conditions>
                <action type="Rewrite" url="/appservices/service1.svc/{R:1}" />
            </rule>
        </rules>
    </rewrite>
</system.webServer>
+2

, :

  • , domain.domain.com godaddy. Ping , , . IIS - services.domain.com. - - : domain.com

  • SSL-, : services.domain.com. web.config , , , HTTPS.

    <system.webServer>
    <rewrite>
      <rules>
        <rule name="Redirect to HTTPS" stopProcessing="true">
          <match url="(.*)" />
          <conditions>
            <add input="{HTTPS}" pattern="^OFF$" />
          </conditions>
          <action type="Redirect" url="https://{HTTP_HOST}/{R:1}" redirectType="Permanent" />
        </rule>
      </rules>
    </rewrite>
    

    enter code here

+1
  • GoDaddy somedomain.com, services.somedomain.com "A" IP- . - , .

  • : somedomain.com, *.somedomain.com. - , , .

  • SSL - Let encrypt, .

  • , URL, /appservices/service1.svc , , services.somedomain.com .

0

All Articles