Project

General

Profile

Support #2145

Whttpd & /etc/hosts

Added by Anonymous about 8 years ago. Updated about 8 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.

#1

Updated by Wim Dumon about 8 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.

#2

Updated by Bud T about 8 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.

#3

Updated by Bud T about 8 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.

#4

Updated by Wim Dumon about 8 years ago

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

BR,

Wim.

#5

Updated by Bud T about 8 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

#6

Updated by Wim Dumon about 8 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
#7

Updated by Bud T about 8 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.

#8

Updated by Wim Dumon about 8 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.

#9

Updated by Bud T about 8 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.

#10

Updated by Wim Dumon about 8 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.

Also available in: Atom PDF