• Stars
    star
    737
  • Rank 59,344 (Top 2 %)
  • Language
    JavaScript
  • License
    ISC License
  • Created about 9 years ago
  • Updated 28 days ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

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

iisexpress-proxy

NPM version License Stars Downloads Sponsor the author
Contributors Last commit Forks Closed issues

iisexpress-proxy

A simple, yet practical command-line utility enabling .NET developers to test web applications served by IIS Express on remote devices.

Motivation

Are you a .NET developer building mobile web applications? Have you ever been frustrated by the fact that there's no easy way to enable IIS Express to accept connections from remote devices?...

Installation

There's no need to install iisexpress-proxy if you're using npm@^5.2.0; you can simply run it with npx. If you're using an older version of npm, you'll most likely want iisexpress-proxy installed as a global module:

npm install -g iisexpress-proxy

Note: You need to have Node.js installed.

Usage

If you're using npm@^5.2.0:

npx iisexpress-proxy localPort to proxyPort

Alternatively, if you installed iisexpress-proxy as a global npm module:

iisexpress-proxy localPort to proxyPort

For instance, if your application's IIS Express port is 51123, run this in the Command Prompt:

iisexpress-proxy 51123 to 3000

The program will list the external addresses you can use for testing your application on remote devices.

iisexpress-proxy defaults to http, so if your application is running https, then include the full URL.

iisexpress-proxy https://localhost:51123 to 3000

Note that this will terminate HTTPS. On your destination machine, connect to port 3000 using HTTP, not HTTPS.

If you want the proxy itself to serve HTTPS, you can specify the target with the full URL as well.

iisexpress-proxy https://localhost:51123 to https://*:3000

This will generate a self-signed certificate and use it, openssl must be in PATH for this to work.

If you're on Windows, the easiest way to get openssl is to use Git Bash that comes with it pre-installed.

If you want to bind to a specific interface instead of all of them, use its IP in the target URL, e.g. https://10.0.0.1:3000. Note that the right-hand part cannot be a domain name.

Advanced usage (VPN, virtual hosts, etc.)

You can also use iisexpress-proxy to expose an IIS server instance running on a different host accessible through VPN, like this:

iisexpress-proxy host:port to proxyHost:proxyPort

For instance, let's conside this scenario:

  • the application is running on 192.168.96.3:5000 and it only accepts connections from clients within a VPN;
  • your development machine has a network interface within the same VPN and another publicly accessible one (192.168.0.102);
  • you need to test the application from mobile devices without having to add those devices to the VPN.

By running this in the Command Prompt:

iisexpress-proxy 192.168.96.3:5000 to 192.168.0.102:3000

...you'll be able to access the application by pointing the mobile devices to 192.168.0.102:3000.

For another advanced example, consider that you're on public Wifi and don't want to publicly expose your dev server. You could set up a VPN between your laptop and your phone and only expose the server on the VPN interface (10.0.0.1). Then you can run

iisexpress-proxy 5000 to 10.0.0.1:8080

...and open http://10.0.0.1:8080 on your phone with VPN enabled, while other wifi users won't be able to connect.

Note: This functionality was added at v1.1.0 (released 10/21/2015).

WebSocket support was added in v1.4.0 by Stan Hebben - see PR #11 for details.

If you don't want using generated certificates you could provide your own certificate and key using cert/key arguments:

iisexpress-proxy https://localhost:51123 to https://*:3000 --key=./your-key.pem --cert=./your-cert.pem

Note: This functionality was added at v1.7.0 (released 02/14/2022).

Limitations

iisexpress-proxy doesn't work in scenarios involving integrated Windows authentication (see issue #here).

How does it work

It's proxying the HTTP traffic on localPort to proxyPort on all the available network interfaces and it's also changing the origin of the host header, allowing you to test web applications hosted by IIS Express on various remote devices (mobile devices, other desktops, etc.).

If you need to access the original host requested by the browser, the request headers will include X-Forward headers. In ASP.NET, Request.Headers["x-forwarded-host"] will contain the requested host.

Credits and attributions

This command-line utility wraps http-proxy. The original http-proxy logo was created by Diego Pasquali.

Contributors

Contributors list

Endorsing the author

If you find this repo useful, please give it a star, tweet about it and endorse me on LinkedIn:

Ionut-Cristian Florescu on LinkedIn

Before raising issues

I'm getting lots of questions from people just learning to do web development or simply looking to solve a very specific problem they're dealing with. While I will answer some of them for the benefit of the community, please understand that open-source is a shared effort and it's definitely not about piggybacking on other people's work. On places like GitHub, that means raising issues is encouraged, but coming up with useful PRs is a lot better. If I'm willing to share some of my code for free, I'm doing it for a number of reasons: my own intellectual challenges, pride, arrogance, stubbornness to believe I'm bringing a contribution to common progress and freedom, etc. Your particular well-being is probably not one of those reasons. I'm not in the business of providing free consultancy, so if you need my help to solve your specific problem, there's a fee for that.

❤️🇺🇦

On 24th of February 2022 Russia unlawfully invaded Ukraine. This is an unjustified, unprovoked attack on the sovereignty of a neighboring country, but also an open affront to international peace and stability that has the potential to degenerate into a nuclear event threatening the very existence of humanity. I am a Romanian (EU) citizen, but I stand with Ukraine and I am doing everything in my power to stop this madness. Here's how you can show your support.

License

The ISC License.

More Repositories

1

mantine-datatable

The table component for your Mantine data-rich applications, supporting asynchronous data loading, column sorting, custom cell data rendering, context menus, nesting, Gmail-style batch row selection, dark theme, and more.
TypeScript
799
star
2

trpc-sveltekit

End-to-end typesafe APIs with tRPC.io for your SvelteKit applications.
TypeScript
695
star
3

openshift-cartridge-nodejs

Custom cartridge for OpenShift providing the lastest version of Node.js.
Shell
221
star
4

trpc-sveltekit-example

A sample SvelteKit application built to illustrate the usage of ✨ trpc-sveltekit.
Svelte
130
star
5

mantine-contextmenu

Craft your applications for productivity and meet your users’ expectations by enhancing your Mantine-based UIs with a desktop-grade, lightweight yet fully-featured, dark-theme aware context-menu component, built by the creator of Mantine DataTable.
TypeScript
98
star
6

expose-wsl

The simplest way to expose apps running on WSL to local network devices.
JavaScript
86
star
7

openshift-cartridge-mongodb

Custom cartridge for OpenShift providing MongoDB > 3.2.
Shell
70
star
8

textdiff-create

Create lean text diff deltas.
JavaScript
36
star
9

aspax

The simple Node.js asset packager.
CoffeeScript
17
star
10

textdiff-patch

Apply lean text diff delta patches created by textdiff-create.
JavaScript
17
star
11

quickstart-express-react

Combined live/hot-reloading quickstart for Express.js/React
JavaScript
16
star
12

trpc-transformer

A simple tRPC transformer based on superjson with decimal.js support
JavaScript
14
star
13

openshift-cartridge-mysql

Custom cartridge for OpenShift providing MySQL 5.7.17
Shell
13
star
14

vlc-3-appimage

A repository for building a VLC 3.0.3 AppImage on Travis CI
Shell
11
star
15

postgresql-tsearch-utils

A collection of files and patterns to improve PostgreSQL text search
11
star
16

aspa

End of Life Notice - January 2014: Please use ASPAX instead.
CoffeeScript
9
star
17

aspa-express

ASPA-Express is an Express/Connect module to use web assets packaged by ASPA
JavaScript
9
star
18

interiordelight.ro.v1

interiordelight.ro
JavaScript
7
star
19

quick-romanian-freelance-tax-calculator

A quick & dirty tax calculator for Romanian freelancers.
Svelte
6
star
20

openshift-cartridge-postgresql

Custom OpenShift cartridge aiming to provide the most recent stable PostgreSQL version packaged by bigsql.org.
Shell
6
star
21

gulp-js-with-nancy-fx

A Node.js-based front-end development workflow for ASP.NET
CSS
5
star
22

icflorescu

Ionut-Cristian Florescu
2
star
23

mantine-contextmenu-v6

The lightweight yet customisable context-menu for your Mantine applications, with a succinct API and dark-theme support. Compatible with Mantine V6.
TypeScript
2
star
24

qilive-q8912-kbd-driver-win-ro

Driver Windows pentru tastatură Bluetooth cu layout românesc Q.8912 de la Qilive
2
star
25

aspax-styl-handler

Plugin enabling ASPAX to handle Stylus files.
CoffeeScript
2
star
26

aspax-ls-handler

Plugin enabling ASPAX to handle LiveScript files.
LiveScript
2
star
27

aspax-jade-handler

Plugin enabling ASPAX to handle Jade files.
CoffeeScript
2
star
28

aspax-iced-handler

Plugin enabling ASPAX to handle IcedCoffeeScript files.
CoffeeScript
2
star
29

aspax-coffee-handler

Plugin enabling ASPAX to handle CoffeeScript files.
CoffeeScript
2
star
30

basic-stylus-grid

A very simple CSS grid system in less than 35 lines of code using Stylus
2
star
31

aspax-less-handler

Plugin enabling ASPAX to handle LESS files.
CoffeeScript
2
star
32

aspax-demo

A simple Node.js application to demonstrate the usage of ASPAX package manager.
JavaScript
1
star
33

aspax-express

Module enabling Express.js to handle assets built and packaged by ASPAX.
JavaScript
1
star
34

flutter_course

Code for Maximilian's Flutter course
Dart
1
star
35

next-netlify-blog-starter

JavaScript
1
star
36

galanta

A minimal UI library to make your Svelte apps look stylish
Svelte
1
star
37

flutterux

A Dart / Flutter / Redux project sample.
Dart
1
star
38

next8-babel-issue

A repo demonstrating issue #6273 in Next.js
JavaScript
1
star
39

mantine-datatable-v6

The table component for your Mantine data-rich applications, supporting asynchronous data loading, column sorting, custom cell data rendering, context menus, nesting, Gmail-style batch row selection, dark theme, and more.
TypeScript
1
star