Project

General

Profile

Actions

Support #2145

open

Whttpd & /etc/hosts

Added by Anonymous over 10 years ago. Updated over 10 years ago.

Status:
Feedback
Priority:
Low
Assignee:
-
Target version:
-
Start date:
08/22/2013
Due date:
% Done:

0%

Estimated time:

Description

Can we configure such that calls resolve to Whttpd when domain as specified in local hosts file is edited like:

127.0.0.1 localhost
127.0.0.1 mydomain.lcl
127.0.0.1 www.mydomain.lcl

I tried it without success.

Actions #1

Updated by Wim Dumon over 10 years ago

  • Status changed from New to Feedback

Hello,

Can you tell us what you want to do? Wt has no direct business with /etc/hosts, the operating system interfaces with that file.

BR,

Wim.

Actions #2

Updated by Bud T over 10 years ago

I'd prefer to call appname.lcl to view a project (or something like it) than to use 127.0.0.1:8080 to view it.

Actions #3

Updated by Bud T over 10 years ago

In Apache this would be accomplished by updating the ServerName in the vhosts.conf file. It is not clear to me what the corollary to this action is within whttp.

Actions #4

Updated by Wim Dumon over 10 years ago

wthttpd does not support virtual hosts as configuration, so this should simply work without configuration.

BR,

Wim.

Actions #5

Updated by Bud T over 10 years ago

Wim Dumon wrote:

wthttpd does not support virtual hosts as configuration, so this should simply work without configuration.

This is what I have in my hosts file on Windows 7:

127.0.0.1:8080 localhost
127.0.0.1:8080 domain.lcl
127.0.0.1:8080 www.domain.lcl

These don't resolve to the Wt app which otherwise display fine when calling http://127.0.0.1:8080

Actions #6

Updated by Wim Dumon over 10 years ago

host files should not contain port numbers. The correct hosts file would be:

127.0.0.1 localhost
127.0.0.1 domain.lcl
127.0.0.1 www.domain.lcl
Actions #7

Updated by Bud T over 10 years ago

Wim Dumon wrote:

host files should not contain port numbers. The correct hosts file would be:

[...]

I tried that earlier: it resolved to port 80 which is configured for Apache, not whttp.

Actions #8

Updated by Wim Dumon over 10 years ago

There is no way to solve this with hosts files, those are only used for IP address resolution. Configure apache to send a redirect to localhost:8080, or to reverse proxy to port 8080.

BR,

Wim.

Actions #9

Updated by Bud T over 10 years ago

I'd prefer not to hack it as I'm using Apache for another project. It seems to me like there should be a way to set up an alias in any web server.

Actions #10

Updated by Wim Dumon over 10 years ago

Hello Brad,

Your browser is always going to send a request to port 80 of your computer unless you put :portnumber in the url. The hosts file cannot change that. Support for aliases in Wt cannot change that (note in Wt you can look at the Host http header to decide what WApplication you instantiate, which mimics support for virtualhosts). To do what you want, you will have to modify your Apache configuration since only one application can listen at port 80.

BR,

Wim.

Actions

Also available in: Atom PDF