DWR

Add support for reverse proxies

Details

  • Type: Improvement Improvement
  • Status: Resolved Resolved
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: None
  • Fix Version/s: 3.0.RC2
  • Component/s: Engine
  • Description:
    Hide
    DWR does not support the use of a reverse proxy before the web server.
    eg. if you have a server inside your company network (http://internalserver/) where tomcat with a dwr app is running and a reverse proxy which populates this server to the internet (http://www.externalserver.com/myapp/).
    DWR generates the path for calls on the server by using request object. It does not recognize that the server can also be accessed via http://www.externalserver.com/myapp/.
    You cannot use the overridePath config option because users can also access the server via http://internalserver/.

    So the best solution would be several possible solutions:
    - Generate the path for DWR calls on the client by a javascript function (don't know exactly if this works because the path is alsp dependent on the servlet path of the dwr servlet)
    - Change the configuration of overridePath so that you can also configure a javascript function to generate the path

    For us we patched the DefaultRemoter (in dwr 2.0.1) by setting a javascript function instead of a fixed path to the "._path" property.
    we changed line 166 in DefaultRemoter to: buffer.append(scriptName + "._path = getActualPath();\n");
    where getActualPath is a javascritp function we defined in the jsp before engine.js is included. So the path is built in the client side.
    Second thing we did was to configure overridePath to; <dwr:config-param name="overridePath" value="&quot;+getActualPath()+&quot;"/>
    so the urls in engine.js looks like this: dwr.engine._defaultPath = ""+getActualPath()+"";

    Cheap and ugly trick, but works for now. it would be great if you could add real support for this problem.



    Show
    DWR does not support the use of a reverse proxy before the web server. eg. if you have a server inside your company network (http://internalserver/) where tomcat with a dwr app is running and a reverse proxy which populates this server to the internet (http://www.externalserver.com/myapp/). DWR generates the path for calls on the server by using request object. It does not recognize that the server can also be accessed via http://www.externalserver.com/myapp/. You cannot use the overridePath config option because users can also access the server via http://internalserver/. So the best solution would be several possible solutions: - Generate the path for DWR calls on the client by a javascript function (don't know exactly if this works because the path is alsp dependent on the servlet path of the dwr servlet) - Change the configuration of overridePath so that you can also configure a javascript function to generate the path For us we patched the DefaultRemoter (in dwr 2.0.1) by setting a javascript function instead of a fixed path to the "._path" property. we changed line 166 in DefaultRemoter to: buffer.append(scriptName + "._path = getActualPath();\n"); where getActualPath is a javascritp function we defined in the jsp before engine.js is included. So the path is built in the client side. Second thing we did was to configure overridePath to; <dwr:config-param name="overridePath" value="&quot;+getActualPath()+&quot;"/> so the urls in engine.js looks like this: dwr.engine._defaultPath = ""+getActualPath()+""; Cheap and ugly trick, but works for now. it would be great if you could add real support for this problem.

Issue Links

People

Dates

  • Created:
    21/Dec/07 10:33 AM
    Updated:
    14/Apr/10 4:43 AM
    Resolved:
    14/Apr/10 4:42 AM