GithubHelp home page GithubHelp logo

icflorescu / iisexpress-proxy Goto Github PK

View Code? Open in Web Editor NEW
736.0 29.0 84.0 254 KB

A simple local proxy for accessing IIS Express from remote machines.

License: ISC License

JavaScript 100.00%
iis iis-express proxy iisexpress-proxy nodejs javascript visual-studio http-proxy windows

iisexpress-proxy's Issues

SSL Support

Hi! Been using it successfully for a while. What about sites running on SSL? Is it possible to bridge those?

Offline installation fails - npmbox npmunbox

I receive the following trying to install to a system with no internet connection.:
c:>npmunbox -v -g iisexpress-proxy.npmbox

Unboxing iisexpress-proxy.npmbox...
Unpacking iisexpress-proxy.npmbox...
Installing iisexpress-proxy...
npm verb request uri https://registry.npmjs.org/iisexpress-proxy
npm verb request no auth needed
npm info attempt registry request try #1 at 11:53:50 AM
npm verb request id e98fff2ab2b30d40
npm http request GET https://registry.npmjs.org/iisexpress-proxy
An error occurred while installing iisexpress-proxy.
iisexpress-proxy was not installed.
{ [Error: connect ETIMEDOUT 151.101.44.162:443]
code: 'ETIMEDOUT',
errno: 'ETIMEDOUT',
syscall: 'connect',
address: '151.101.44.162',
port: 443 }
Done.

Great utility

However, you would earn greater respect from a far greater percentage of developers if you were to leave your anti Russian political diatribe out of GitHub !

Redirects to the IIS server should be transformed

When the IIS express server does a redirect (status 301, 302, 303, 307, 308), the same port-redirection should be applied.

For example, I started the proxy with iisexpress-proxy 53856 to 8079. When IIS express then sends a location:http://localhost:53856/login/ header, it should be rewritten to location:http://<request-host>:8079/login/, because the original URL will by definition not work.

SignalR not working with proxy.

WebSocket connection to 'ws://guest:5000/signalr/connect?transport=webSockets&clientProtocol=1.5&connectionToken=2sHfR1yy9nfjoohNtgQy2uUIFHvIsSkKJMf5vBWPwUhm4yFGjvmrfwoFV%2BME5LjVCY7JziJjNjneWF3Z3QyLyIY6tSeCwhtgxE%2FeiInNhgB8%2BSVzRPsEQE4xa6SE%2Fo8ipbs9cyXiDI6R7%2BpbNBXYXTE1%2BGZOqaZrfFHPBVW7YhI%3D&connectionData=%5B%7B%22name%22%3A%22scannerhub%22%7D%5D&tid=5' failed: Connection closed before receiving a handshake response

This is the error I receive in a page that have SignalR client. Probably it is not supporting web sockets.

Doesn't work with HTTPS

Dear developer,

I have a.NET app, which works only in localhost, because if I am trying to connect to it remotely I get a Bad Request error. I am trying to redirect localhost port to my public interface:

C:\Users\a>iisexpress-proxy https://localhost:41959 to 41000
IIS Express Proxy 1.1.8
Proxying https://localhost:41959 to network interfaces:
Local Area Connection: 192.168.1.10:41000
Listening... [press Control-C to exit]

...and the result is:

https://192.168.1.10:41959: can't open the page

a$ curl https://192.168.1.10:3000 -v

  • Rebuilt URL to: https://192.168.1.10:3000/
  • Trying 192.168.1.10...
  • Connected to 192.168.1.10 (192.168.1.10) port 3000 (#0)
  • WARNING: using IP address, SNI is being disabled by the OS.
  • Server aborted the SSL handshake
  • Closing connection 0
    curl: (35) Server aborted the SSL handshake

http://192.168.1.10:41959:

Aw snap! Something went wrong. Check your console to see the error.

Log:
Error: unable to verify the first certificate
at Error (native)
at TLSSocket. (_tls_wrap.js:1060:38)
at emitNone (events.js:86:13)
at TLSSocket.emit (events.js:185:7)
at TLSSocket._finishInit (_tls_wrap.js:584:8)
at TLSWrap.ssl.onhandshakedone (_tls_wrap.js:416:38)
Listening... [press Control-C to exit]

I think because we redirect https to http. Is there any way to keep the https connection? My app can listen on https only.

Something like this:

C:\Users\a>iisexpress-proxy https://localhost:41959 to https://:41000

Regards,
Adrian

unable to use it on android emulator like gennymotion

Microsoft Windows [Version 10.0.14393]
(c) 2016 Microsoft Corporation. All rights reserved.
C:\Users\SHILPA>iisexpress-proxy 54704 to 54300
IIS Express Proxy 1.3.0
Proxying http://localhost:54704 to network interfaces:
VirtualBox Host-Only Network: 192.168.141.2:54300
Ethernet: 192.168.93.1:54300
Ethernet 2: 192.168.193.1:54300
Wireless Network Connection: 192.168.0.2:54300
Listening... [press Control-C to exit]
^CTerminate batch job (Y/N)? y

Url not matching regex

After I have installed iis-express following error is thrown:

iisexpress-proxy https://localhost:44355/ to 3000
IIS Express Proxy 1.7.3
C:\Users{username}\AppData\Roaming\npm\node_modules\iisexpress-proxy\index.js:39
var targetMatch = args._[4].match(urlRegExp);
^

TypeError: args._[4].match is not a function
at Object. (C:\Users{username}\AppData\Roaming\npm\node_modules\iisexpress-proxy\index.js:39:29)
at Module._compile (internal/modules/cjs/loader.js:1063:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
at Module.load (internal/modules/cjs/loader.js:928:32)
at Function.Module._load (internal/modules/cjs/loader.js:769:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:72:12)
at internal/main/run_main_module.js:17:47

VPN functionality not working

My server is connected to a VPN and I tried using your method of using the command but I can't seem to connect to the server while it's in the VPN. I'm still trying to understand how IIS is used when the machine is connected o a proxy but I don't have any luck fixing the problem.

Support a range of ports?

First of all thanks for this great little tool! Would it be possible to support a range of ports? I have multiple sites running on different ports (like port 8100 to port 8105). It would be great if we could specify a range of ports to be proxied, so for example that the port s 8100 to 8105 would be mapped to a range from 3001 to 3005. This way it would not be necessary to start iisexpress-proxy multiple times for each site.

Error: Can't set headers after they are sent.

iisexpress-proxy 2097 to 5000
Listening... [press Control-C to exit]
_http_outgoing.js:356
throw new Error('Can't set headers after they are sent.');
^

Error: Can't set headers after they are sent.
at ServerResponse.OutgoingMessage.setHeader (_http_outgoing.js:356:11)
at ServerResponse.writeHead (_http_server.js:180:21)
at ProxyServer. (C:\Users\javier\AppData\Roaming\npm\node_modules\iisexpress-proxy\index.js:64:7)
at ProxyServer.emit (C:\Users\javier\AppData\Roaming\npm\node_modules\iisexpress-proxy\node_modules\eventemitter3\index.js:144:27)
at ClientRequest.proxyError (C:\Users\javier\AppData\Roaming\npm\node_modules\iisexpress-proxy\node_modules\http-proxy\lib\http-proxy\passes\web-incoming.js:156:18)
at emitOne (events.js:96:13)
at ClientRequest.emit (events.js:188:7)
at Socket.socketErrorListener (_http_client.js:310:9)
at emitOne (events.js:96:13)
at Socket.emit (events.js:188:7)

Swagger doesn't work properly with the plugin

The "forwarding" works just fine, but in case of usage with Swagger - swagger has issues connecting. Usually returns

{
  "error": "no response from server"
}

in case of Json
Despite that, if you call the methods via postman, on the external IP, it works just fine.

HTTPS

Hi !

How can i make this working with https url ?

Thanks

Problematic dependency on OpenSSL

I tried to run iisexpress-proxy, both using npx and installing it globally via npm. In both cases, it errored because it couldn't find the openssl command. This is confusing, because there is no mention of openssl in the README dependencies, and yet it seems like a must-have for this to work. In any case, I downloaded openssl and then added it to my PATH variable, then had to manually create a openssl.cnf file and add that to my environment variables as OPENSSL_CONF.

Finally then did the iisexpress-proxy command run, however now it's erroring about a key being too small.

PS C:\Users\justintoth> iisexpress-proxy https://localhost:44359 to https://auth-dev.mydomain:443
IIS Express Proxy 1.6.0
Proxying https://localhost:44359 to network interfaces:
node:internal/tls/secure-context:65
    context.setCert(cert);
            ^

Error: error:140AB18F:SSL routines:SSL_CTX_use_certificate:ee key too small
    at node:internal/tls/secure-context:65:13
    at Array.forEach (<anonymous>)
    at setCerts (node:internal/tls/secure-context:63:3)
    at configSecureContext (node:internal/tls/secure-context:152:5)
    at Object.createSecureContext (node:_tls_common:116:3)
    at Server.setSecureContext (node:_tls_wrap:1344:27)
    at Server (node:_tls_wrap:1203:8)
    at new Server (node:https:69:3)
    at Object.createServer (node:https:105:10)
    at ProxyServer.listen (C:\Users\justintoth\AppData\Roaming\npm\node_modules\iisexpress-proxy\node_modules\http-proxy\lib\http-proxy\index.js:129:11) {
  library: 'SSL routines',
  function: 'SSL_CTX_use_certificate',
  reason: 'ee key too small',
  code: 'ERR_SSL_EE_KEY_TOO_SMALL'
}

Does this tool still work and I'm just missing something obvious?

permissions denied

I'm getting this error (windows 10):

C:\WINDOWS\system32>iisexpress-proxy 5003 to 8099
IIS Express Proxy 1.4.9
Proxying http://localhost:5003 to network interfaces:
VMware Network Adapter VMnet1: 192.168.88.1:8099
VMware Network Adapter VMnet8: 192.168.60.1:8099
Wi-Fi: 192.168.178.20:8099
vEthernet (Default Switch): 172.17.216.49:8099
Error: listen EACCES: permission denied 0.0.0.0:8099
at Server.setupListenHandle [as _listen2] (net.js:1262:19)
at listenInCluster (net.js:1327:12)
at Server.listen (net.js:1414:7)
at Object. (C:\Users\ronta\AppData\Roaming\npm\node_modules\iisexpress-proxy\index.js:72:13)
at Module._compile (internal/modules/cjs/loader.js:778:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
at Module.load (internal/modules/cjs/loader.js:653:32)
at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
at Function.Module._load (internal/modules/cjs/loader.js:585:3)
at Function.Module.runMain (internal/modules/cjs/loader.js:831:12)
Listening... [press Control-C to exit]
C:\Users...\AppData\Roaming\npm\node_modules\iisexpress-proxy\index.js:77
res.writeHead(500, {
^

TypeError: Cannot read property 'writeHead' of undefined
at Server. (C:\Users...\AppData\Roaming\npm\node_modules\iisexpress-proxy\index.js:77:7)
at Server.emit (events.js:198:13)
at emitErrorNT (net.js:1306:8)
at process._tickCallback (internal/process/next_tick.js:63:19)
at Function.Module.runMain (internal/modules/cjs/loader.js:834:11)
at startup (internal/bootstrap/node.js:283:19)
at bootstrapNodeJSCore (internal/bootstrap/node.js:622:3)

Tried also using console with admin rights

Request requires localhost

Hi, the proxy forwards to 127.0.0.1 which results in a refused connection. I only seem to be able to request successfully from localhost. Why might this be?

AWS EC2

This works beautifully on my dev laptop, thanks, but how to use it on a Win Server 2016 EC2 instance?

It sees the private IP address, but I need it to listen to the public IP address.

So something like iisexpress-proxy 51123 to publicip:3000

Inside the instance, ipconfig does not show the public ip address.

Url not matching regex ^2

In addition to #35 - maybe same thing missing here:

const sourceMatch = args._[2].match(urlRegExp);

so perhaps?

const sourceMatch = String(args._[2]).match(urlRegExp);

Because IIS Express Proxy 1.7.4 is giving me
args._[2].match is not a function

: Awesome work.
signed.

localhost subdomain

Hello,

I have multiple websites served from my asp.net core mvc app.

specifically, ct-1.localhost and ct-2.localhost.

this is the command line i tried:
npx iisexpress-proxy http://ct-1.localhost:62114 to 3000

and this is the response upon requesting it externally:

PS C:\Users\xxx> npx iisexpress-proxy ct-1.localhost:62114 to 3000
{
  _: [
    'C:\\Program Files\\nodejs\\node.exe',
    'C:\\Users\\xxxx\\AppData\\Roaming\\npm\\node_modules\\iisexpress-proxy\\index.js',
    'ct-1.localhost:62114',
    'to',
    3000
  ]
}
IIS Express Proxy 1.7.13
Proxying http://ct-1.localhost:62114 to network interfaces:
        Ethernet: http://192.168.1.171:3000
        Ethernet 2: http://192.168.56.1:3000
Listening... [press Control-C to exit]
Error: getaddrinfo ENOTFOUND ct-1.localhost
    at GetAddrInfoReqWrap.onlookupall [as oncomplete] (node:dns:118:26) {
  errno: -3008,
  code: 'ENOTFOUND',
  syscall: 'getaddrinfo',
  hostname: 'ct-1.localhost'
}
^C^CTerminate batch job (Y/N)? y

if I serve 62114 to 3000 my web portal shows, and displays my default behavior of showing me links to ct-1.localhost and ct-2.localhost, so the website is working correctly at bare minimum.

I have also tried ct-1.desktop-name:3000 and the browser returns IP not found.

I have used your tool many times for other web apps, and I am very happy it has worked so well!

This is just a out-of-the-norm use-case. Any help is appreciated, Thanks!

Dynamically generated absolute URLs are broken

I have a method in my web app that builds absolute URLs (for assets). Using this proxy causes all links generated by this method to fail (links are referencing the old localhost url instead of the one in the browser). This would be great otherwise.

        public static string BuildAbsoluteURL(string virtualPath)
        {
            bool https = HttpContext.Current.Request.IsSecureConnection;
            if (!https)
            {
                var xproto = HttpContext.Current.Request.Headers["X-FORWARDED-PROTO"];
                if (xproto != null && xproto.ToLower() == "https")
                    https = true;
            }
            var absolutePathTarget = new Uri("http://" + HttpContext.Current.Request.Url.Authority + HttpContext.Current.Request.ApplicationPath.TrimEnd('/') + VirtualPathUtility.ToAbsolute(virtualPath, System.Web.HttpContext.Current.Request.ApplicationPath));
            var url = absolutePathTarget.ToString();
            if (https)
                url = "https://" + url.Substring("http://".Length);
            return url;
        }

Error: connect ECONNREFUSED

Version 1.0.1

Crash when request to 10.211.55.3:4000 on Windows 10.

C:\Users\wk>iisexpress-proxy 25840 to 4000
IIS Express Proxy 1.0.1
Proxying localhost:25840 to:
- Ethernet: 10.211.55.3:4000
Listening... [ press Control-C to exit ]
C:\Users\wk\AppData\Roaming\npm\node_modules\iisexpress-proxy\node_modules\http-proxy\lib\http-proxy\index.js:119
    throw err;
          ^
Error: connect ECONNREFUSED
    at exports._errnoException (util.js:746:11)
    at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1010:19)

Using IIS Express with Internet Connection Sharing

Hi,

Unfortunately, I am obliged to use ICS to share my internet connection.

With ICS enabled, I am unable to run IIS Express - I get this error:

"c:\Program Files\IIS Express\iisexpress" /port:63293 /path:"C:\Visual Studio Projects\Cornhouse.PepperFactory\Cornhouse.PepperFactory.UI"
Copied template config file 'c:\Program Files\IIS Express\AppServer\applicationhost.config' to 'D:\Temp\iisexpress\applicationhost2016423131125484.config'
Updated configuration file 'D:\Temp\iisexpress\applicationhost2016423131125484.config' with given cmd line info.
Starting IIS Express ...
Failed to register URL "http://localhost:63293/" for site "Development Web Site" application "/". Error description: Access is denied. (0x80070005)
Registration completed
Unable to start iisexpress.

Access is denied.
For more information about the error, run iisexpress.exe with the tracing switch enabled (/trace:error).

Is there any way that iisexpress-proxy can help me with this?

My knowldege of networking is about zilch!

Many thanks
Jeremy

Cannot access RESTful URLs which are returning UTF8+BOM encoded JSON

Hi,

it seems that the proxy is trying to parse JSON that is going through it. I can access static pages via the proxy without any problems, but when I am trying to access any restful services, then it fails with the following error:

Error: Parse Error
    at Error (native)
    at Socket.socketOnData (_http_client.js:309:20)
    at emitOne (events.js:77:13)
    at Socket.emit (events.js:169:7)
    at readableAddChunk (_stream_readable.js:153:18)
    at Socket.Readable.push (_stream_readable.js:111:10)
    at TCP.onread (net.js:531:20)

If more information is needed, please let me know.

Thanks,
Ignas

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.