Question

I'm trying to get it so that any requests made to:

http://<myserver>:1234

are redirected to:

https://<myserver>:1234

I've tried using "this.RequiresHttps()" in modules, but when I hit the url http://<myserver>:1234, the browser just spins, and I'm guessing it's because I didn't construct NancyHost with an HTTP URI. I can't add the HTTP URI to NancyHost along with the HTTPS URI like so:

var host = new NancyHost(new Uri("http://localhost:1234"), new Uri("https://localhost:1234"));

because I'll get registration conflicts.

Any ideas?

Était-ce utile?

La solution

You cant have http and https listening on the same port. Change the port for your https binding, and specify it in your RequiresHttps call.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top