Вопрос

I would use sub-domain, for this, I'm trying to use this code:

import 'dart:io';

import 'package:http_server/http_server.dart';

void main() {
    HttpServer.bind('localhost', 8080).then((server) {
        final virtualServer = new VirtualHost(server);
        virtualServer.addHost('test.mydomain.com').listen((HttpRequest req) {
            print('Got it');
        });
    });
}

I go on test.mydomain.com:8080, and maybe because it's normal, this doesn't work.

Where I'm wrong ? It's the way to use it, or my code ? And how fix it ?

Это было полезно?

Решение

Try adding your domain to the hosts file

Другие советы

As JAre has mentioned above add your subdomains to your hosts file (in my case on OSX in /etc/hosts):

127.0.0.1 test.mydomain.com
127.0.0.1 test2.mydomain.com
Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top