Skip to content
This repository was archived by the owner on May 1, 2020. It is now read-only.

Commit 8e1e81a

Browse files
committed
feat(): change http-server to use request hostname instead of the configured hostname.
1 parent 3001190 commit 8e1e81a

File tree

2 files changed

+1
-4
lines changed

2 files changed

+1
-4
lines changed

src/dev-server/http-server.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ function serveIndex(req: express.Request, res: express.Response) {
8282
const indexFileName = path.join(config.wwwDir, process.env[Constants.ENV_VAR_HTML_TO_SERVE]);
8383
fs.readFile(indexFileName, (err, indexHtml) => {
8484
if (config.useLiveReload) {
85-
indexHtml = injectLiveReloadScript(indexHtml, config.host, config.liveReloadPort);
85+
indexHtml = injectLiveReloadScript(indexHtml, req.hostname, config.liveReloadPort);
8686
}
8787

8888
indexHtml = injectNotificationScript(config.rootDir, indexHtml, config.notifyOnConsoleLog, config.notificationPort);

src/dev-server/live-reload.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,6 @@ export function injectLiveReloadScript(content: any, host: string, port: Number)
5353
}
5454

5555
function getLiveReloadScript(host: string, port: Number) {
56-
if (host === '0.0.0.0') {
57-
host = 'localhost';
58-
}
5956
var src = `//${host}:${port}/livereload.js?snipver=1`;
6057
return ` <!-- Ionic Dev Server: Injected LiveReload Script -->\n <script src="${src}" async="" defer=""></script>`;
6158
}

0 commit comments

Comments
 (0)