… so what I was trying to say (I’m not yet too deep into the websockets tech):

isn’t it —in the described case— also necessary to configure the mount point of 
the WS endpoint?

   Tom



> On 05.10.2016, at 17:42, Tom Götz <t...@decoded.de> wrote:
> 
> BTW, I already tried the following workaround without success:
> 
> I did override WebSocketBehavior#renderHead and included a „patched“ JS init 
> script that contained the contextPath that ngnix is forwarding to, so the 
> generated JS looked like this:
> 
> if (typeof(Wicket.WebSocket.appName) === "undefined") {
>  jQuery.extend(Wicket.WebSocket, { pageId: 1, resourceName: '',
>    baseUrl: ‚MyHomePage?1', contextPath: ‚/MyLocation', appName: ‚myApp',
>    filterPrefix: '' });
>  Wicket.WebSocket.createDefaultConnection();
> }
> 
> But still I got an 404 for the ws endpoint …
> 
>   Tom
> 
> 
>> On 05.10.2016, at 17:35, Tom Götz <t...@decoded.de> wrote:
>> 
>> I created a JIRA for this: https://issues.apache.org/jira/browse/WICKET-6254
>> 
>>  Tom
>> 
>> 
>>> On 05.10.2016, at 17:31, Martin Grigorov <mgrigo...@apache.org> wrote:
>>> 
>>> The problem is that Nginx is configured to forward requests to /MyLocation
>>> to Tomcat, and the application has no idea about this.
>>> 
>>> Martin Grigorov
>>> Wicket Training and Consulting
>>> https://twitter.com/mtgrigorov
>>> 
>>> On Wed, Oct 5, 2016 at 5:25 PM, Tom Götz <t...@decoded.de> wrote:
>>> 
>>>> Hi Martin,
>>>> 
>>>> what exactly is the problem in wicket-websocket-jquery.js? As I said, I
>>>> have no contextPath, so I wouldn’t expect Wicket/wicket-websocket-jquery.js
>>>> to know under which context the app is running. Shouldn’t I provide the
>>>> context/mountPath somehow to the websocket initialization process?!
>>>> 
>>>> Tom
>>>> 
>>>>> On 05.10.2016, at 16:47, Martin Grigorov <mgrigo...@apache.org> wrote:
>>>>> 
>>>>> Hi Tom,
>>>>> 
>>>>> The problem really is in wicket-websocket-jquery.js.
>>>>> It does: url = protocol + '//' + document.location.host +
>>>> WWS.contextPath +
>>>>> WWS.filterPrefix + '/wicket/websocket';
>>>>> 
>>>>> A workaround for you is to add url rewrite rule to Nginx to forward it to
>>>>> Tomcat.
>>>>> 
>>>>> Please file an issue at JIRA and I'll see how this could be improved.
>>>>> 
>>>>> 
>>>>> Martin Grigorov
>>>>> Wicket Training and Consulting
>>>>> https://twitter.com/mtgrigorov
>>>>> 
>>>>> On Wed, Oct 5, 2016 at 4:31 PM, Tom Götz <t...@decoded.de> wrote:
>>>>> 
>>>>>> Hm, no solution yet … anyone got a working example or some hint maybe?
>>>>>> 
>>>>>> Tom
>>>>>> 
>>>>>> 
>>>>>>> On 05.10.2016, at 15:57, Tom Götz <t...@decoded.de> wrote:
>>>>>>> 
>>>>>>> Maybe answering my own question, but this here could help … I’ll give
>>>> it
>>>>>> a try:
>>>>>>> http://stackoverflow.com/questions/32287103/how-to-use-
>>>>>> nginx-as-a-proxy-for-wicket-application-using-websockets
>>>>>>> 
>>>>>>> Cheers,
>>>>>>> Tom
>>>>>>> 
>>>>>>> 
>>>>>>>> On 05.10.2016, at 15:36, Tom Götz <t...@decoded.de> wrote:
>>>>>>>> 
>>>>>>>> Hi there,
>>>>>>>> 
>>>>>>>> I have the following scenario:
>>>>>>>> 
>>>>>>>> 1.
>>>>>>>> a Spring-Boot Wicket application with Tomcat running on Port 8080 that
>>>>>> uses Wicket WebSockets impl running in the servlet root context
>>>>>>>> 
>>>>>>>> 2.
>>>>>>>> a ngnix server that proxies /MyLocation to the mentioned Wicket app
>>>>>>>> 
>>>>>>>> As there is no servlet context involved, the generated WebSockets
>>>>>> endpoint url is generated by Wicket as: ws://mydomain.com/wicket/
>>>>>> websocket?pageId=1&wicket-ajax-baseurl=...
>>>>>>>> 
>>>>>>>> I saw that this url is generated in BaseWebSocketBehavior#renderHead
>>>>>> by asking the request for the context path:
>>>>>>>> 
>>>>>>>> String contextPath = component.getRequest().getContextPath();
>>>>>>>> variables.put("contextPath", contextPath);
>>>>>>>> 
>>>>>>>> As I don’t have a contextPath, this fails:
>>>>>>>> 
>>>>>>>> WebSocket connection to 'ws://mydomaon.com/wicket/
>>>>>> websocket?pageId=1&wicket-ajax-baseurl=...' failed: Error during
>>>>>> WebSocket handshake: Unexpected response code: 404
>>>>>>>> 
>>>>>>>> Does the Wicket WebSocket API provide a way to handle such a scenario?
>>>>>> Currently, I’m studying the code but any pointer would be helpful …
>>>>>>>> 
>>>>>>>> Cheers,
>>>>>>>> Tom
>>>>>> 
>> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org

Reply via email to