A developer’s look at Weglot’s reverse proxy solution and JavaScript integration.
Configure Weglot’s Content Delivery Network for a fully translated website in minutes. Choose between our "subdomain" and "subdirectory" based on how you want the translated pages to appear.
For example, "https://fr.yoursite.com" or "https://yousite.com/fr." For subdomain mode, you'll edit your DNS settings to create specific subdomains for each new language and point them to the Weglot servers.
For subdirectory mode, you can choose between 2 integrations:
Any request for a translated version of your website will deliver blazing fast results to your customer in their native language. Plus, a layer of cache on top of the Weglot translation API means if the exact same translation request is sent twice, it will remember the answer and send it back to you instantly. Weglot’s reverse proxy solution provides you with a fully SEO-friendly version of your website that’s easily indexed by global search engines.
Website visitor asks for a page of your website in French. The subdomain fr. points to the Weglot Reverse Proxy Server.
Weglot Reverse Proxy makes a HTTP call to your original website.
Your website sends back the original HTML page (non-translated).
Weglot Reverse Proxy sends the content of that page to Weglot API to retrieve the translations
Weglot Reverse Proxy sends back a response to the visitor’s browser
Website visitor asks for a page of your website in French. The subdirectory /fr/ points to the Weglot Reverse Proxy Server.
Weglot Reverse Proxy makes a HTTP call to your origin endpoint (An IP or a CNAME entry).
Your website sends back the original HTML page (non-translated).
Weglot Reverse Proxy sends the content of that page to Weglot API to retrieve the translations
Weglot Reverse Proxy sends back a response to the visitor’s browser
Website visitor asks for a translated page. The request hits your Reverse Proxy.
For a translated page, the request is routed to Weglot Reverse Proxy, through a URL like : render.weglot.io/htt
ps://mysite.com/fr/
accueil
Weglot RP fetches the original page by making a HTTP call to https://mysite.com/
home (*)
This calls lands again on your reverse proxy and goes to your origin endpoint as it's a non-translated page this time. Weglot RP receive the original HTML page.
Weglot Reverse Proxy sends the content of that page to Weglot API to retrieve the translations.
Weglot RP sends back a response to your reverse proxy with the translated page. Your reverse proxy sends back the response to the browser.
The Weglot JavaScript integration is the fastest and simplest way to set up translations for your website. By just copy-pasting a few lines of JavaScript, you can translate any website in seconds. It’s best used for testing, when you don’t need to be visible on global search engines or when you want to translate private content.
The translations are fetched and then inserted into the page by the browser after it has downloaded the page source.
This means the translations are not stored in any source code and therefore not detected by search engines.
Website visitor asks for a page on your website.
Your server sends the page back to the website visitor’s browser in the original language, with a script tag calling the Weglot JS library.
The library detects the user language, based on their choice or their locale, gathers all the content, and sends it to the Weglot Translation API.
The Weglot Translation API sends the translations back, and the Weglot JS library swaps the original content for the translations.
A website translation solution with zero developer effort
Read more on our dedicated developer documentation