Browsing to Web Sites Hosted on my Paperspace


#1

So I’m on a mac. I have a Paperspace instance running Windows Server for web development. I have a public IP setup and working. I’ve setup a mapped drive to my code directory in the PS instance, so I can mount it on my mac as a samba share, and code against it there. Overall all that is working.

I want to be able to browse to that site in a browser on my Mac. I’ve updated my host file to add an entry to the site pointing to the public IP. When I try to browse to it I’m getting 403 Forbidden URL. Is there something more I need to do on the Mac or Windows side to make this work? Add a mapping in IIS, or port forwarding or something?

Also to note, a possible additional complication is the site is coded to look specifically for localhost (instead of some custom domain like mysite.com). so what I have mapped is in my Mac hosts file is:
123.456.789.10 localhost
and I’ve commented out the default entry to 127.0.0.1.

Thanks in advance for responses.


#2

Hi Philip,

It sounds like IIS is trying to serve you a part of the Windows VM that is inaccessible. This boils down to configuring IIS to point at the right place, ie setting up a virtual directory and its permissions.

This old but trusted write-up should get you a working site within IIS:

https://support.microsoft.com/en-us/help/323972/how-to-set-up-your-first-iis-web-site

And here you can find a more detailed explanation of the IIS architecture and how each object relates to one another:

You should remove that hosts entry from your Mac right away since that can greatly hinder the operation of your local OS (your Mac) since applications querying ‘localhost’ will actually try to query an IP address on the Internet instead of your local system.

HTH,

Tom


#3

Thanks for your reply, however I’m not sure this is what I need. I already have a site setup in IIS within my Paperspace. It has its own virtual directories to access other files. The issue is that site’s Bindings have a hostname of “localhost”, and the site code itself has several hardcoded references to “localhost”. I know thats not ideal, but I didn’t craft the site, and right now its too big of a change to alter the code to accept some alias such as local.mysite.com.

In Paperspace, if I open Chrome or Firefox, I can go to http:// localhost and this site loads and works.
I need to be able to do that on my Mac as well, so I can browse the site in a Mac browser.

Note, there are 2 other sites setup in PS that have custom domains, so on my Mac I updated my hosts file link those custom domains to my PS’s public IP and it all works. I just can’t do the same with “localhost” because, well its “localhost”.

As mentioned, I think I need to do some port forwarding trickery here but I’m not sure and don’t really know how to do that correctly. So something like http:// localhost would open my Mac’s local web folder, and http:// localhost:9999 would open the PS’s IIS web root.