Weglot and CORS Policies

In this article, you'll learn more about CORS Policies and how to solve potential issues related to them and Weglot.


What are CORS Policies?

CORS stands for Cross-Origin Resource Sharing. It is a browser security mechanism that uses specific HTTP response headers to control whether a web page can request resources from a different origin (domain, protocol, or port).

By default, browsers only allow requests to be made from the same origin (the same website) for security reasons (a rule known as the “same-origin policy”). CORS provides a controlled way for servers to allow requests to be made from a different origin (an external website).

When a web page makes a cross-origin HTTP request, the browser checks whether the server includes the appropriate CORS headers (such as Access-Control-Allow-Origin  ).

  • If the headers are present and valid, the browser allows the request.
  • If not, the browser blocks access to the response for security.

If you would like more information on CORS and its technical aspects, please refer to the following documentation.

How can CORS policies potentially block Weglot?

When Weglot is set up on your website, it will send requests to our API to translate the website's content. However, if CORS policies do not authorize the Weglot API, the requests will be blocked, and the website will not be translated.

Additionally, if Weglot's user-agent is not authorized, it can cause issues, such as blocking our Visual Editor and our Switcher Editor.

Here is an example of an error you can get in the Console when facing CORS Policies issues. To access the Console, right-click on your website > choose the Inspector > click on "Console".

How to deal with potential issues?

Before you proceed, it is first important to understand the concept of whitelisting.

Whitelisting is the process of informing an element that a specific source, origin, or other element is authorized to perform a particular action. This element is then added to a list called a whitelist.

To deal with the potential issues linked to CORS Policies that you may face, you can contact your hosting provider (see below) and ask to whitelist the following domains: api.weglot.com, weglot.com, weglot.io, dashboard.weglot.com. Please also ask to allow our user-agent Mozilla/5.0 (compatible; WeglotBot/1.0; +https://weglot.com/)  related to the Visual Editor and Switcher Editor.

Also, please make sure the URL or script source related to the CORS Policy error is not part of your URL exclusion rules, which you can find inside your Weglot Dashboard > Project > Settings > Translation Exclusions.

What is a hosting provider?

Hosting providers enable individuals or larger organizations to access resources from the Internet through their connection to multiple servers.

Thanks to these providers, individuals or organizations can create and deploy their own websites on the World Wide Web. They provide storage space, maintain the connection to the Internet, and assist in managing the website design and database.

Many hosting providers also offer domain name management, allowing users to rent and manage their domain names through their DNS (Domain Name System) configuration. With this access, they can configure your website to point directly to their hosting provider.

For more information about hosting providers, please refer to this external article.

Some of the well-known web hosting providers include Ionos, GoDaddy, DreamHost, Hostinger, and Bluehost.


If you continue to experience trouble with CORS Policies despite the solutions above, please don't hesitate to contact us at support@weglot.com.

Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.

Still need help? Contact Us Contact Us