Task #2311
closedNeed to handle 404 pages in helponline.libreoffice.org
100%
Description
I need a way to handle 404 page not found inside helponline.libreoffice.org
Ideally, it could be redirected to
https://libreoffice.online.org/latest/<lang>/swriter/main0000.html
where <lang> is picked from users HTTP header
and
https://libreoffice.online.org/latest/en-US/swriter/main0000.html
if the <lang> is not supported in LibreOffice.
current supported langs are
ALL_LANGS='en-US af am ar as ast be bg bn bn-IN bo br brx bs ca ca-valencia cs cy da de dgo dz el en-GB en-ZA eo es et eu fa fi fr ga gd gl gu gug he hsb hi hr hu id is it ja ka kk km kmr-Latn kn ko kok ks lb lo lt lv mai mk ml mn mni mr my nb ne nl nn nr nso oc om or pa-IN pl pt pt-BR ro ru rw sa-IN sat sd sr-Latn si sid sk sl sq sr ss st sv sw-TZ ta te tg th tn tr ts tt ug uk uz ve vec vi xh zh-CN zh-TW zu'
these languages are listed in
solenv/inc/langlist.mk
Thanks
Updated by Guilhem Moulin almost 7 years ago
https://libreoffice.online.org/latest/<lang>/swriter/main0000.html
where <lang> is picked from users HTTP header
You mean the "Accept-Language" header? Its value is complicated
https://tools.ietf.org/html/rfc7231#section-5.3.5
https://tools.ietf.org/html/rfc4647#section-2.1
and parsing it on the httpd seems overkill (if at all feasible). Could you give an example of such a request? Maybe <lang> could be extracted from the URL instead, falling back to en-US.
https://libreoffice.online.org/latest/en-US/swriter/main0000.html
Pretty sure that's not the domain name we want :-P Assuming you meant helponline.libreoffice.org
, the server now serves /var/www/html/latest/en-US/swriter/main0000.html
(which doesn't exist yet) upon 404.
Updated by Olivier Hallot almost 7 years ago
Ouch... Sorry for the mess, my brain-check.
You are right.
<Lang> can be extracted from URL indeed.
and the website/page is
https://helponline.libreoffice.org/latest/<lang>/text/swriter/main0000.html
with fall-back to en-US:
https://helponline.libreoffice.org/latest/en-US/text/swriter/main0000.html
Updated by Guilhem Moulin almost 7 years ago
Alright. I'd rather not hardcode the list of languages again, so/$version/$lang/…
redirects to /$version/$lang/text/swriter/main0000.html
if /$version/$language
is a directory, and /$version/en-US/text/swriter/main0000.html
otherwise.
$ curl -I https://helponline.libreoffice.org/latest/de/xyz/ HTTP/1.1 302 Moved Temporarily Server: nginx/1.6.2 Date: Tue, 04 Jul 2017 20:13:44 GMT Content-Type: text/html Content-Length: 160 Location: https://helponline.libreoffice.org/latest/de/text/swriter/main0000.html Connection: keep-alive
$ curl -I https://helponline.libreoffice.org/latest/xyz/xyz/ HTTP/1.1 302 Moved Temporarily Server: nginx/1.6.2 Date: Tue, 04 Jul 2017 20:13:20 GMT Content-Type: text/html Content-Length: 160 Location: https://helponline.libreoffice.org/latest/en-US/text/swriter/main0000.html Connection: keep-alive
It's not entirely satisfactory as requests enter a redirection loop if /$version/$lang
exists but /$version/$lang/text/swriter/main0000.html
doesn't (for instance if a new language is being deployed). I'll think of a better solution, but feel free to provide feedback meanwhile.
Updated by Guilhem Moulin almost 7 years ago
- Status changed from New to Closed
- % Done changed from 0 to 100
Closing this now. Please reopen if that's not the fix you had in mind ;-)
Updated by Olivier Hallot almost 7 years ago
Hi
I tested with the following URL: https://helponline.libreoffice.org/xyz to trigger a 404 and I get... a 404 nginx page.
I wanted it to fall back to https://helponline.libreoffice.org/6.0/en-US/text/swriter/main0000.html
Can it be done?
Updated by Guilhem Moulin almost 7 years ago
Olivier Hallot wrote:
I tested with the following URL: https://helponline.libreoffice.org/xyz to trigger a 404 and I get... a 404 nginx page.
Ah yeah, there was no default for the LO version. (Not sure how users would end up visiting such URL from the help menu, but fixed anyway.)
I wanted it to fall back to https://helponline.libreoffice.org/6.0/en-US/text/swriter/main0000.html
I assumed you meant https://helponline.libreoffice.org/latest/…
not https://helponline.libreoffice.org/6.0/…
. (At least I don't want to change the version in nginx's config whenever we have a new release :-P)
Can it be done?
Sure, done.