---
title: "本地访问本地机器时localhost和hasIpAddress('192.168.1.0/16')不匹配"
author: "black_angle"
date: "2010-05-20T13:38:34Z"
tags: []
categories: ["企业架构"]
slug: "localhost-hasipaddress-192-168-1-0-16"
draft: false
lastmod: "2010-05-20T13:38:34Z"
id: 670652
url: "https://black-angle.iteye.com/blog/670652"
---

因为当时用[http://localhost:8081/bs/](http://localhost:8081/bs/)访问本地的应用程序时

request.getRemoteAddr() 获取到的是 127.0.0.1，所以和hasIpAddress('192.168.1.0/16')不匹配

要用地址

[http://192.168.33.88:8081/bs/](http://192.168.33.88:8081/bs/)访问就可以了