Project

General

Profile

Actions

Bug #2449

closed

URLs without language trigger page not found

Added by Alexander Watzinger 11 months ago. Updated about 1 month ago.

Status:
Closed
Priority:
Normal
Target version:
Start date:
2025-01-16
Estimated time:
Found in version:

Description

I noticed at the demo versions that when an URL without language is provided that it gets redirected correctly, e.g.

https://frontend-demo.openatlas.eu/entity/2936 ->
https://frontend-demo.openatlas.eu/en/entity/2936

but then a page not found error is shown (tested with Firefox and Chromium). When refreshing the page it works.
For now I "fixed" it in the demo versions with adding the language part to the resolver URL in the backend so that at least the backend links aren't broken.

I tried the same at a different project (MAMEMS) but there it seems to work in general without a language part in the URL and there are no issues.
URLs without the language part should always work as expected because these are also provided with the citation button.

Update
For the specific situation of using the (more) static deploy version (without the Node.js server) via Apache and using multiple languages for the presentation site (like in the demo versions) this could be solved with adding following to the Apache config.

<VirtualHost *:443>

        ...

        <IfModule mod_rewrite.c>
                # Already localized? do nothing
                RewriteCond %{REQUEST_URI} ^/(en|de)(/|$) [NC]
                RewriteRule ^ - [L]

                # Bypass static & API
                RewriteCond %{REQUEST_URI} ^/(assets|dist|_nuxt|static|img|images|css|js|fonts|favicon\.ico|robots\.txt|sitemap\.xml|api)(/|$) [NC]
                RewriteRule ^ - [L]

                # Fallback to English
                RewriteCond %{REQUEST_URI} ^/entity/([0-9]+)$
                RewriteRule ^/entity/([0-9]+)$ /en/entity/%1 [R=302,L,QSA]
        </IfModule>

        ...

</VirtualHost>

The available languages and the default language have to be adapted when needed. It's a simple approach that works.
See e.g. https://frontend-demo.openatlas.eu/entity/2936
More complex functionality might be possible (e.g. detecting cookies, browser settings, ...) but beside being way more work and need for testing just for a very specific scenario I'm also not convinced that these issues should be solved at the Apache config level.


Files

.htaccess (1.66 KB) .htaccess Bernhard Koschiček-Krombholz, 2025-10-28 14:35
example.conf (2.14 KB) example.conf Bernhard Koschiček-Krombholz, 2025-10-28 14:35

Related issues 1 (0 open1 closed)

Related to OpenAtlas Discovery - Question #2645: URL got by permalink button in OpenAtals discovery returns Page not foundClosedAlexander Watzinger2025-10-17Actions
Actions #1

Updated by Alexander Watzinger 11 months ago

I just found a project (MoByz) running on Kubernetes that uses the language part and there it seems to work, see e.g.: https://mobyz-atlas.openatlas.eu/entity/738
So this problem might be deployment specific at the demo sites. In that case it isn't that urgent but it still should be fixed at some point.

Actions #2

Updated by Katharina Wünsche 10 months ago

  • Target version changed from 0.8.0 to 0.9.0
Actions #3

Updated by Olivia Reichl 5 months ago

  • Target version changed from 0.9.0 to 0.10.0
Actions #4

Updated by Katharina Wünsche 3 months ago

  • Target version changed from 0.10.0 to 1.1.0
Actions #5

Updated by Katharina Wünsche 3 months ago

  • Target version changed from 1.1.0 to 1.0.0
Actions #6

Updated by Katharina Wünsche 3 months ago

  • Assignee set to Alexander Watzinger
Actions #7

Updated by Katharina Wünsche 3 months ago

  • Status changed from Acknowledged to Assigned
Actions #8

Updated by Alexander Watzinger 3 months ago

So I looked into the Apache logs and found a 404 error when the language parameter isn't provided.
I'm not sure what I can do from my (Apache) side to solve this but I'm open for suggestions.

Actions #9

Updated by Alexander Watzinger 3 months ago

  • Status changed from Assigned to In Progress

I talked with @Christoph Hoffmann about it and he gave some interesting insights.

Apparently the site redirects correctly (that's why the URL has than the language part and a reload shows the site correctly).
But the content still states Page not found because it isn't reloaded. For that a node server would be needed.

Because a node server isn't an option for this scenario, alternatives would be (from best to worst):
  • Solve the issue somehow, e.g. maybe an Apache redirect could help. I will wait for the return of @Stefan Probst to discuss it in more detail.
  • Show a site to choose a language instead
  • Add to the readme/install notes of OpenAtlas Discovery that for these URLs to work correctly, a node server is needed
Actions #11

Updated by Alexander Watzinger 2 months ago

  • Related to Question #2645: URL got by permalink button in OpenAtals discovery returns Page not found added
Actions #12

Updated by Alexander Watzinger about 2 months ago

@Stefan Probst kindly took the time to look at the issue with us too.

It looks like the easiest way to solve this would be via Apache redirects and I will look into that.
Once solved, we will also document it for others that want to take the more static deployment approach too.

Updated by Bernhard Koschiček-Krombholz about 2 months ago

@Alexander Watzinger: I know you are not keen of using LLMs, so I did it for you.
Attached are two files, one is an example.conf, for the Apache site configuration.

The other is a possible .htaccess file. This could be tracked in the OpenAtlas Discovery repo, so no need to play around with the apache conf directly. The .htaccess should be automatically ignored if deployed in k8s, nginx or any docker situation.

I couldn't test it, but maybe it is a good start.

Actions #14

Updated by Alexander Watzinger about 2 months ago

  • Description updated (diff)
  • Status changed from In Progress to Resolved

I added a possible solution to the description and set the issue on resolved to allow for some time to detect problems with this approach.
If you, @Katharina Wünsche or @Olivia Reichl kindly specify where and in which branch I can add this to the documentation/installation notes as well.

Thanks to all involved for your support for having solved this issue.

Actions #15

Updated by Alexander Watzinger about 2 months ago

  • Description updated (diff)
  • Status changed from Resolved to In Progress

I have to take it back. For some reason it doesn't work anymore, further investigation will be needed.

Actions #16

Updated by Alexander Watzinger about 2 months ago

  • Description updated (diff)
  • Status changed from In Progress to Resolved

Sorry for the back and forth but I found the issue and it should work now as expected.
Nevertheless I will leave this on resolved for now in case we run into more issues with the redirects.

Actions #17

Updated by Alexander Watzinger about 1 month ago

  • Status changed from Resolved to Closed

The Apache fix seems to work and I documented it in the README in the develop branch.
Thanks to all involved,

Actions

Also available in: Atom PDF