Change CodeServer URL

50 views
Skip to first unread message

Gordan Krešić

unread,
Apr 27, 2021, 5:40:48 AMApr 27
to GWT Users
Is there a way to force .nocache.js file to use CodeServer's URL different
from $wnd.location.hostname?

I would like to run CodeServer via HAProxy (to enable HTTPS, so I can test
features available only on HTTPS).

Currently, I'm modifying .nocache.js file and change URL by hand and that
works, but it gets rewritten on every CodeServer start.

So, back to my initial question: does anyone knows a way to configure
CodeServer's URL stored in .nocache.js file?

-gkresic.

David Nouls

unread,
Apr 27, 2021, 6:37:19 AMApr 27
to GWT Users
I don’t think that is possible.

In my project I am using a reverse proxy that fronts both my website and the codeserver and it replaces the nocache file. I also change the generated output of the codeserver because otherwise the sourcemaps do not work with newer versions of Chrome.

I would love to hear if there are easier solutions to this problem

Kind regards
David
--
You received this message because you are subscribed to the Google Groups "GWT Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-tool...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-web-toolkit/dc1ed392-6e0d-304e-b375-15b83bb8b4bd%40steatoda.com.

Vassilis Virvilis

unread,
Apr 27, 2021, 6:38:47 AMApr 27
to google-we...@googlegroups.com
No sure about that, but if you want to debug in https:// I have written a blog post after reading the github issue: https://github.com/gwtproject/gwt/issues/7535


Hope this helps.


--
You received this message because you are subscribed to the Google Groups "GWT Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-tool...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-web-toolkit/dc1ed392-6e0d-304e-b375-15b83bb8b4bd%40steatoda.com.


--
Vassilis Virvilis

Gordan Krešić

unread,
Apr 27, 2021, 6:43:27 AMApr 27
to google-we...@googlegroups.com
On 27. 04. 2021. 12:37, Vassilis Virvilis wrote:
> No sure about that, but if you want to debug in https:// I have written a
> blog post after reading the github issue:
> https://github.com/gwtproject/gwt/issues/7535
>
> https://vasvir.wordpress.com/2017/02/07/gwt-super-dev-mode-https-setup-in-7-steps/

Yep, overriding default linker looks like the only solution.

Tnx.

-gkresic.

Maarten Daalder (ISAAC Software Solutions)

unread,
Apr 27, 2021, 9:32:27 AMApr 27
to GWT Users
For our GWT RPC services we set serviceEntryPoint to the actual URL by casting the Async service instances to com.google.gwt.user.client.rpc.ServiceDefTarget. We have this part of our XSRF token distribution.

Gordan Krešić

unread,
Apr 27, 2021, 11:24:28 AMApr 27
to google-we...@googlegroups.com
Nope, CodeServer's .nocache.js file is not result of linking, but simple
template:

https://github.com/gwtproject/gwt/blob/master/dev/codeserver/java/com/google/gwt/dev/codeserver/stub.nocache.js

Used very simply by CodeServer's LauncherDir:

https://github.com/gwtproject/gwt/blob/47f0f717ed7653c853ef03b5bf511f38e0143c80/dev/codeserver/java/com/google/gwt/dev/codeserver/LauncherDir.java#L122

Looks like Vassilis'es solution worked only using bookmarklets:

https://github.com/gwtproject/gwt/issues/7535

So I downgraded my expectations:

1. I run CodeServer once to get .nocache.js it generates

2. Modified it (basically, just changed serverUrl declaration) and saved
under different name

3. Updated my index.html to include that renamed .nocache.js

Works for debugging session, but now I have to be careful not to let this
slip into production.

-gkresic.

Thomas Broyer

unread,
Apr 27, 2021, 12:23:40 PMApr 27
to GWT Users
Why do you need this? http://localhost is already a secure context, enabling everything that's otherwise available only through HTTPS: https://developer.mozilla.org/en-US/docs/Web/Security/Secure_Contexts
Or are you testing remotely and cannot use http://localhost either?

Gordan Krešić

unread,
Apr 27, 2021, 2:04:27 PMApr 27
to google-we...@googlegroups.com
On 27. 04. 2021. 18:23, Thomas Broyer wrote:
> Why do you need this? http://localhost is already a secure context, enabling
> everything that's otherwise available only through
> HTTPS: https://developer.mozilla.org/en-US/docs/Web/Security/Secure_Contexts
> Or are you testing remotely and cannot use http://localhost either?

Nope, testing Facebook Login (among others), which requires redirect URLs
which can't be on localhost (Facebook policy). So I have to create
local.mydomain.com which resolves to 127.0.0.1 via /etc/hosts, but that is
not (secure) localhost anymore, at least according to Chrome.

-gkresic.

Craig Mitchell

unread,
Apr 29, 2021, 2:34:47 AMApr 29
to GWT Users
From memory, Facebook will let you test with http://lvh.me

Gordan Krešić

unread,
Apr 29, 2021, 2:49:14 AMApr 29
to google-we...@googlegroups.com
On 29. 04. 2021. 08:34, Craig Mitchell wrote:
> From memory, Facebook will let you test with http://lvh.me

Excellent trick, thanks!

However, here are other things I have to solve, too, like the need to test
other browsers in local LAN that don't support resolutions via /etc/hosts
neither will work with lvh.me (because CodeServer is not on *their*
localhost). Smartphones/tablets are obvious example.

-gkresic.

David Nouls

unread,
Apr 29, 2021, 3:33:39 AMApr 29
to google-we...@googlegroups.com

In my project we solved this issue by putting a reverse proxy in front of both the CodeServer running on localhost and our application running on another machine. We are not using facebook authentication but we have our own SAML based auth system

I based that implementation on thomas his devserver project:
https://github.com/tbroyer/gwt-devserver

But I had to implement a few changes to make it fully work since codeserver dictates what path you should use to download the source maps for example. It would be nice if the CodeServer could be instructed to serve files from a different path than the root one. that would make it easier to fully support it.

Kind regards
David
--
You received this message because you are subscribed to the Google Groups "GWT Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-tool...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages