Web server URL not working for BOTH "www" version and normal version

Wappler Version : 3.3.4
Operating System : Win 10,
NodeJS / Docker project. Target deployed via Wappler/Docker Machines on Linode with Traefik/Let’s encrypt and Portainer.

Expected behavior

When you set the web server url in the target, it should work for both “www” and “normal” versions of the domain (if you also have your DNS set up correct)

image

image

Actual behaviour

Even though i have my DNS records set up with the example.com and www.example.com they will not BOTH work at the same time.

Only the web server set up in the target will work. So if i set www.example.com in the target, that URL will work and take me to the website.

While that is set, if i try to access the skite at example.com, i get a blank page with 404 error.

If i reverse it in the target settings, the opposite happens. (so i can access example.com if that is what is in the target, but then www.example.com will give a 404 error.)

More of the error:

Referrer Policy: strict-origin-when-cross-origin

The fact that you can change the settings in the target and access one of the urls at a time, shows that DNS is set up for both www and normal.

How to reproduce

As above.

Set up NodeJS/Docker/Linode/Traefik/Portainer project.
Set up SSL
Se up DNS
Try and access both ww and normal versions of domain.

The fact that everything was set up via Wappler and Docker Machines leads me to believe its an issue here, rather than on Linode as i haven’t had to do anything with them except set up DNS.

Actually this is not a bug, but a question of site setup - what you want to do in case you want a site to respond on both with and without www and what you really want to happen.

There are many scenarios possible, following up some basic questions:

  • do you want your site to be available on both domains without and with www?
  • notice that those are two different domains! So they have separate cookies. This means that if user logs in to the www domain and then go to the site without www, different cookies will be send!
  • do you want to appoint one domain as main? So users get redirected to the main domain when entering the other? Like redirecting automatically from www to without www
  • then again note that you still have two different domains - so you will need to have different Let’s encrypt certificates for those - even if it is for redirect only.

So as you see a lot of questions to be answered, before settings can be done.

I think we should add a bit more Traefik settings to handle all those different settings and redirects

Ok, I understand. I guess in a normal PHP/apache web server type project you would just edit the htacess file and redirect one domain to the other (if that’s what you wanted)

My limited understanding though with NodeJS is that it isn’t as straight forward as that and that’s when you would use something like Node Balancer or Traefik in this case to redirect traffic?

Personally I would think the default option would be people want both of those domains to go the se site…as some people and links will still type in the more outdated www

This was implemented in Wappler a few updates ago.

Now Traefik handles both www and non-www sites and redirect to what you have specify as main Website URL.

This topic was automatically closed after 46 hours. New replies are no longer allowed.