42Webserver / 42-Vienna-Webserv

This project is about writing our own HTTP server in C++
1 stars 0 forks source link

Confing listen #52

Closed Nikster3k closed 1 month ago

Nikster3k commented 2 months ago

I think it is possible to have "listen example.com:8080" in the config file. We have to check with nginx. Because you can use getaddrinfo and put in "example.com" and if "/etc/hosts" has an entry for that domain it will return the corresponding ip

windchaser-surf commented 1 month ago

Nginx, try to bind all ip-adress for example if we have www.google.com => then it converts to the ip-adress => and bind fails. if we have nothing.com => it doesn't find the host. so we don't have to check if there is an syntax error at listen. We just split host:port, check with getaddrinfo, and if error_code == 0, we try to bind

windchaser-surf commented 1 month ago

Fix: Can use any host or ip adress, and also ports but for port: 0-1024 => need sudo rights, for example if you use port 80 => then you don't need to specify the port at the browser, Also protected port syntax, => 123as was valid. no you can use: www.google.com:8090 => fails at bind like in nginx; nothingasdf.com:8080 => fails at getaddrinfo => error host not found; if you set at /etc/hosts: 127.0.0.1 flori.de flori:de:8080 => works!