0

I have inherited a website that was working, but another technician broke it, and now I have been hired to fix it.

The primary domain is hosted at GoDaddy a very simple html site 25 pages or fewer. It does not require SSL.

The part that is broken is a SQL landing page, it is hosted on servers located within the company. This "portal" does require SSL, and the IIS is working fine, but what I can't figure out is how he was redirecting the subfolder to the second host.

www.example.com is hosted at xxx.xxx.xxx.xxx
www.example.com/sqldatabase is hosted at yyy.yyy.yyy.yyy

Any ideas?

  • 1
    A reverse proxy? (Or an iframe - but that would have been easy to spot.) – DocRoot Mar 19 '18 at 22:15
  • Definitely not iframe, the folder doesn't even exist at xxx.xxx.xxx.xxx. I'll have to look into the reverse proxy idea, not sure what that is. – Thomas Strubinger Mar 19 '18 at 23:49
  • Yeah, a proxy is the only way you'll be able to make that one work. I don't know IIS so I can't really give you details either. Another solution would be to use a different sub-domain, but your SSL certificate would probably not match (unless you use something like letsencrypt.org then you could get another cert.) – Alexis Wilke Mar 19 '18 at 23:52
  • I changed your title from "redirect" to "rewrite" because a redirect is usually client side, but you seem to be looking for something server side. – Stephen Ostermiller Mar 20 '18 at 16:00
1

Probaly it's using URL Rewrite to create a reverse proxy to the second site.

You'll need the URL Rewrite module for IIS (https://www.iis.net/downloads/microsoft/url-rewrite) and the ARR (Application Request Routing) module (https://docs.microsoft.com/en-us/iis/extensions/installing-application-request-routing-arr/install-application-request-routing-version-2).

I've not experience with GoDaddy but I've seen in their Windows hosting offering they include full support for URL Rewrite, so it should work without a problem.

You can include a rule like this one in your "/SqlDatabase" folder's web.config under the <configuration><system.webServer> node:

<rewrite>
    <rules>
        <rule name="Reverse Proxy to SqlDatabase" stopProcessing="true">
            <match url="^sqldatabase/(.*)" />
            <action type="Rewrite" url="http://yyy.yyy.yyy.yyy/{R:1}" />
        </rule>
    </rules>
</rewrite>

to have the reverse proxy working. If the app in the second server returns absolute URLs such as http://yyy.yyy.yyy.yyy/... you should add an outbound rule to fix the links and use the original site URL, something like this under the same <rewrite> node:

<outboundRules>
    <rule name="ChangeProxyLinks" preCondition="ResponseIsHtml">
        <match filterByTags="A, Form, Img" pattern="^http(s)?://yyy.yyy.yyy.yyy/(.*)" />
        <action type="Rewrite" value="http{R:1}://xxx.xxx.xxx.xxx/sqldatabase/{R:2}" />
    </rule>
    <preConditions>
        <preCondition name="ResponseIsHtml">
            <add input="{RESPONSE_CONTENT_TYPE}" pattern="^text/html" />
        </preCondition>
    </preConditions>
</outboundRules>

In this way all the links and other references to the original server will be pointing to the new one.

If the server is GoDaddy is not IIS, then you need to know which server is and do the same thing in it. If it's Apache the equivalent to IIS's URL Rewrite would be mod_rewrite.

HTH

  • Thanks Jose, but it seems I was making this project harder that it actually was. I just didn't have all the information, the bottom line is that the DNS information had changed and that is what broke website. – Thomas Strubinger Mar 20 '18 at 20:31
  • Glad to know. Anyway I hope this could be valuable to other users if that were the case. :-) – Jose M Alarcon Mar 20 '18 at 21:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.