Just what i needed. thx
On Thursday, August 11, 2016 at 2:57:38 PM UTC+2, Vyacheslav Rusakov wrote:
>
> You can use jetty Transparent servlet (the same as your ProxyClassic):
>
>
> final ServletRegistration.Dynamic proxy =
> environment.servlets().addServlet("proxy", ProxyServlet.Transparent.class);
> proxy.setInitParameter("proxyTo", "http://test:80/");
> proxy.setInitParameter("prefix", "/old");
> proxy.addMapping("/old/*");
>
>
>
>
> четверг, 11 августа 2016 г., 18:20:31 UTC+7 пользователь Martin M написал:
>>
>> After many attempts at making dropwizard proxy all i get is status code
>> 502 Bad Gateway:
>>
>> I have and old jetty project on http://test:80/
>>
>> and a new dropwizard project on http://dropwizard:8085/
>>
>> I want the old project to be proxied on http://dropwizard:8085/old/
>>
>> I have tried:
>>
>>
>> ProxyClassic proxyClassic = new ProxyClassic("http://test:80/",
>> "/old");
>> environment.servlets().addServlet("ProxyClassic",
>> proxyClassic).addMapping("/old/*");
>>
>> public class ProxyClassic extends ProxyServlet {
>>
>> public ProxyClassic(String proxyTo, String proxyPrefix) {
>> delegate._proxyTo = proxyTo;
>> delegate._prefix = proxyPrefix;
>> }
>>
>> private final TransparentDelegate delegate = new
>> TransparentDelegate(this);
>>
>> @Override
>> public void init(ServletConfig config) throws ServletException {
>> super.init(config);
>> delegate.init(config);
>> }
>>
>> protected static class TransparentDelegate
>> {
>> private final ProxyServlet proxyServlet;
>> private String _proxyTo;
>> private String _prefix;
>>
>> protected TransparentDelegate(ProxyServlet proxyServlet)
>> {
>> this.proxyServlet = proxyServlet;
>> }
>>
>> protected void init(ServletConfig config) throws ServletException
>> {
>> // Adjust prefix value to account for context path
>> String contextPath =
>> config.getServletContext().getContextPath();
>> _prefix = _prefix == null ? contextPath : (contextPath +
>> _prefix);
>> }
>> }
>>
>>
>>
>> <dependency>
>> <groupId>org.eclipse.jetty</groupId>
>> <artifactId>jetty-proxy</artifactId>
>> <version>9.3.9.v20160517</version>
>> <scope>compile</scope>
>> </dependency>
>>
>> I am using dropwizard 1.0.0
>>
>> Any suggestions how i can do this?
>>
>>
--
You received this message because you are subscribed to the Google Groups
"dropwizard-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.