【发布时间】:2016-10-28 04:37:24
【问题描述】:
我正在尝试使用 com.sun.net.httpServer.* 库构建 https 代理服务器。 当我如下定义服务器上下文时:
httpServer.createContext("/test", new MyHandler());
然后我从浏览器打开网址:“https://localhost:443/test”,它按预期工作,但是当以这种方式定义服务器上下文时:
httpServer.createContext("/", new MyHandler());
我注意到当我输入如下 URL 时我的处理程序没有被使用:“https://www.google.co.il/”
我错过了什么?
【问题讨论】:
-
请不要撤消我的编辑,因为它们使内容更易于阅读。
-
您在网络浏览器中输入了
https://www.google.co.il?您是否将浏览器配置为使用 HTTP 代理服务器侦听localhost:443? -
HTTPS URL 以“https://”开头,默认使用端口 443。 (取自:en.wikipedia.org/wiki/HTTPS)
标签: java server httphandler httpserver