Re: Wicket WebSockets problem with servlet context
I don’t think NGINX sets the X-Forwarded headers by default, but it can be configured to do so. In my http and https configurations, I have: proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; -Don > On Oct 9, 2016, at 2:53 AM, Martin Grigorov wrote: > > A question : does Nginx send X-Forwarded-* headers ? > Which ones? > > On Oct 5, 2016 7:16 PM, "Tom Götz" wrote: > >> … 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 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 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 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 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 >> 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 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 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 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 u
Re: Wicket WebSockets problem with servlet context
A question : does Nginx send X-Forwarded-* headers ? Which ones? On Oct 5, 2016 7:16 PM, "Tom Götz" wrote: > … 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 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 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 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 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 > 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 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 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 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 > >
Re: Wicket WebSockets problem with servlet context
… 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 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 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 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 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 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 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 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 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
Re: Wicket WebSockets problem with servlet context
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 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 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 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 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 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 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 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
Re: Wicket WebSockets problem with servlet context
I created a JIRA for this: https://issues.apache.org/jira/browse/WICKET-6254 Tom > On 05.10.2016, at 17:31, Martin Grigorov 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 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 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 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 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 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
Re: Wicket WebSockets problem with servlet context
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 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 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 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 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 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 > >
Re: Wicket WebSockets problem with servlet context
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 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 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 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 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
Re: Wicket WebSockets problem with servlet context
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 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 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 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 > >
Re: Wicket WebSockets problem with servlet context
Hm, no solution yet … anyone got a working example or some hint maybe? Tom > On 05.10.2016, at 15:57, Tom Götz 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 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
Re: Wicket WebSockets problem with servlet context
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 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
Wicket WebSockets problem with servlet context
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