4

I have a use-case where I need to run a simple HTTP server on iOS listening on port 80.

On the device that works fine however on the simulator I get a bind error that port 80 is privileged. This is not critical but makes testing more complicated than needed.

On linux it seems possible to give individual apps access to privileged ports via "setcap 'cap_net_bind_service=+ep' /path/to/program".

How would this work on OSX so that the iPhone Simulator could bind to a privileged port?

Frans
  • 780
  • 7
  • 20
  • possible duplicate of [Binding on privileged ports (ports < 1024) on Mac OS X 10.6](http://stackoverflow.com/questions/7612053/binding-on-privileged-ports-ports-1024-on-mac-os-x-10-6) – Remy Lebeau Nov 26 '14 at 10:04

1 Answers1

0

This is not the answer but you can redirect the traffic from other ports (if you are able for example to start an HTTP server on port 20080) to port 80 using ssh:

ssh -L 80:<iOS Device IP>:20080 localhost

Or socat:

socat TCP-LISTEN:80,fork TCP:<iOS Device IP:20080

Then you can access (you could edit /etc/hosts with a fancy name):

http://localhost/
Vinicius Tinti
  • 143
  • 1
  • 6