부두가 제공하는 투명한 프록시를 사용하려고합니다. 부두 투명한 프록시는 항상 403을 반환합니다.
이
내 web.xml을<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="WebApp_9"
version="2.4"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
<display-name>Archetype Created Web Application</display-name>
<servlet>
<servlet-name>googleProxy</servlet-name>
<servlet-class>org.eclipse.jetty.servlets.ProxyServlet$Transparent</servlet-class>
<init-param>
<param-name>ProxyTo</param-name>
<param-value>http://www.google.com</param-value>
</init-param>
<init-param>
<param-name>Prefix</param-name>
<param-value>/google</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>googleProxy</servlet-name>
<url-pattern>/google/*</url-pattern>
</servlet-mapping>
이며, 이는 (내가 받는다는을 사용하고 있습니다) pom.xml 파일입니다 :
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>JettyProxySample</groupId>
<artifactId>JettyProxySample</artifactId>
<packaging>war</packaging>
<version>1.0</version>
<name>JettyProxySample Maven Webapp</name>
<url>http://maven.apache.org</url>
<dependencies>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-servlets</artifactId>
<version>7.0.0.M4</version>
</dependency>
</dependencies>
<build>
<finalName>JettyProxySample</finalName>
<plugins>
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>maven-jetty-plugin</artifactId>
<version>6.1.10</version>
<configuration>
<scanIntervalSeconds>10</scanIntervalSeconds>
<stopKey>foo</stopKey>
<stopPort>9999</stopPort>
</configuration>
<executions>
<execution>
<id>start-jetty</id>
<phase>pre-integration-test</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<scanIntervalSeconds>0</scanIntervalSeconds>
<daemon>true</daemon>
</configuration>
</execution>
<execution>
<id>stop-jetty</id>
<phase>post-integration-test</phase>
<goals>
<goal>stop</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
내가 프록시를 기대 다음과 같이 요청을 전달하십시오 :
http://localhost:8080/JettyProxySample/google/search?q=hello
이에
:
http://www.google.com/search?q=hello
하지만 브라우저에서 해당 URL을하려고 할 때, 나는 항상이 얻을 :
HTTP ERROR: 403
FORBIDDEN
RequestURI=/JettyProxySample/google/search
Powered by Jetty://
어떤 생각을?
구글 ... 포함되어 있습니다. IP 주소는 무엇입니까? –
@Roman C 나는 그것을 사용하는 방법을 알아 내려고하고 있습니다. 그리고 죄송합니다. "IP 주소 란 무엇입니까?"라는 의미는 무엇입니까? – CuiPengFei
이 문제에 대해서는 docu를 읽어야합니다. –