Need help upgrading to Ionic Framework 4.0? Get assistance with our Enterprise Migration Services EXPLORE NOW


Improve this doc

Embedded httpd for Cordova apps. Light weight HTTP server.



  1. Install the Cordova and Ionic Native plugins:
    $ ionic cordova plugin add cordova-plugin-httpd
    $ npm install --save @ionic-native/httpd@4
  2. Add this plugin to your app's module

Supported platforms


import { Httpd, HttpdOptions } from '@ionic-native/httpd';

constructor(private httpd: Httpd) { }


let options: HttpdOptions = {
     www_root: 'httpd_root', // relative path to app's www directory
     port: 80,
     localhost_only: false

this.httpd.startServer(options).subscribe((data) => {
 console.log('Server is live');

Instance Members


Starts a web server.

Param Type Details
options HttpdOptions

Returns: Observable<string> Returns an Observable. Subscribe to receive the URL for your web server (if succeeded). Unsubscribe to stop the server.


Gets the URL of the running server

Returns: Promise<string> Returns a promise that resolves with the URL of the web server.


Get the local path of the running webserver

Returns: Promise<string> Returns a promise that resolves with the local path of the web server.


Param Type Details
www_root string

The public root directory for your web server. This path is relative to your app's www directory. Default is current directory.

port number

The port number to use. Default is 8888

localhost_only boolean

Setting this option to false will allow remote access to your web server (over any IP). Default is false.