One place for hosting & domains


      502 Bad Gateway Error: What It Is and How to Fix It

      If you run an online business, you’ll want your website to be available at all times. Unfortunately, WordPress problems like the 502 Bad Gateway error are common and can prevent users from accessing your site.

      The good news is that this error is relatively easy to fix. Once you’ve determined the cause, you can take the necessary steps to resolve the problem and make your website accessible again.

      In this post, we’ll take a closer look at the 502 Bad Gateway error message and its leading causes. Then, we’ll show you how to fix it. Let’s get started!

      What Is the 502 Bad Gateway Error?

      Whenever you try accessing a website, your browser sends a request to the site’s server. This server processes the request and returns the data (i.e., the site’s content).

      You’ll see an HTTP status code if something goes wrong during the process. Sometimes, this is accompanied by a message that describes the problem.

      A 502 Bad Gateway error indicates that the server received an invalid response from an inbound server and usually happens if the site is using a proxy or gateway server.

      The error message you see may vary, depending on your browser and the server you’re trying to access. However, typically you’ll receive one of the following alerts:

      • “502 Bad Gateway”
      • “502 Proxy Error”
      • “Error 502”
      • “HTTP Error 502 – Bad Gateway”
      • Temporary Error (502)
      • “502 Service Temporarily Overloaded”

      As you can see, the 502 status code may indicate an issue with the proxy server or a server overload. However, there are other possible causes of this error.

      What Causes the 502 Bad Gateway Error?

      Several issues can return a 502 Bad Gateway error. These include:

      • An unresolved domain name. The domain name might not be connecting to the correct IP address. This can happen because you’ve recently migrated your site to a new host, and the DNS servers haven’t yet finished propagating.
      • An over-sensitive firewall. If your site or your web host is using a firewall, it may be blocking certain internet providers or IP addresses. This happens when the firewall detects a false threat.
      • Server overload. The origin server may have crashed due to a sudden spike in traffic. This problem is more common if you’re on a shared hosting plan and your server has limited resources.

      It’s worth noting that the 502 Bad Gateway error doesn’t always indicate a problem with the server. It can also be caused by a client-side issue, like an outdated browser version or corrupted files in the browser cache.

      How Do You Fix the 502 Bad Gateway Error? (10 Possible Solutions)

      Now, let’s look at how to fix the 502 Bad Gateway error! We’ll cover two scenarios: an issue on the client side and a problem with the server.

      1. Refresh the Page and Try a Different Browser

      Let’s start with the simplest solution. The 502 Bad Gateway error could be a temporary issue. For example, the web server may have become overloaded for a few minutes or experienced a brief surge in traffic.

      Therefore, wait a few moments and reload the site. It’s also a good idea to try accessing the page on a different browser or device. This process will help you determine if it’s a client-side or server-side issue.

      Additionally, you could use a tool like Down for Everyone or Just Me, or Is It Down Right Now to confirm whether the problem is on your end or with the site’s host:

      The “Down for Everyone or Just Me” online tool

      If the results show that the site is up, you’ll need to try a few things on your browser and computer (which we’ll show you in the following steps). On the other hand, if the site is down for everyone, then you’ll have to go into your site’s back end to locate the problem — we’ll look into this later in the post.

      2. Clear Your Browser’s Cache

      Your browser might be storing outdated data for your site, which could lead to the Bad Gateway error. Alternatively, it may contain corrupted files that prevent access to your website.

      It’s a good idea to clear your browser cache. For example, in Google Chrome, click on the three dots in the top right-hand corner and select More tools > Clear browsing data.

      This will launch a popup window:

      Clearing the browser cache in Google Chrome

      Then, choose a time range, make sure the options for Cookies and other site data and Cached images and files are selected, and hit Clear data. Once complete, re-launch the browser and try accessing your site.

      The process for clearing cache in other browsers like Mozilla Firefox is similar. However, if this method doesn’t resolve the 502 gateway issue, you’ll need to move on to the next step.

      Get Content Delivered Straight to Your Inbox

      Subscribe to our blog and receive great content just like this delivered straight to your inbox.

      3. Flush the DNS Cache

      The 502 gateway error could also be caused by a Domain Name System (DNS) issue. For example, if you’ve just migrated your site to a new web host, the propagation process may take up to 48 hours.

      However, there might also be an issue with your local DNS cache. This temporary storage on your device contains information about visited domain names.

      To flush the DNS cache in Windows, press the Windows key, then type in “CMD” and hit Enter:

      Launching the Command Prompt in Windows

      This will bring up the Command Prompt window:

      The Command Prompt Window

      Here, you’ll need to type in the following command:

      ipconfig /flushdns

      When it’s ready, you should see a message that says, “Successfully flushed the DNS resolver Cache”.

      If you have a macOS device, you’ll need to enter the following command in the terminal:

      dscacheutil -flushcache

      Alternatively, you could temporarily change your DNS server to a third-party service, such as Google Public DNS.

      4. Check Your Site’s Error Log

      If your site is down for everyone and the problem is not with your device, you may want to check your error logs. These can help you identify what caused the issue. For example, a plugin conflict or update may have triggered the 502 Bad Gateway error.

      You’ll need to access your site’s files to view these logs. You can do this via the File Manager in your hosting account or a Secure File Transfer Protocol (SFTP) client like FileZilla.

      If you’re a DreamHost customer, log in to your account and navigate to Websites > Manage Websites. Select your site, then navigate to Manage Files and click on Manage:

      The DreamHost hosting account

      This will launch the File Manager. Click on the folder that contains your domain name, and look for wp-content:

      Open the folder and locate a file called debug.log:

      The debug.log file in the File Manager

      Look for the last logged error. It might give you clues as to what has gone wrong. You can then take steps to resolve the issue. For example, you might need to disable a plugin. (We’ll show you how in the next section).

      The process is almost identical if you use an SFTP client or a different hosting account. You can look for a file called error_log (or something similar) in your wp-content folder.

      5. Deactivate Your Plugins and Themes

      If you’ve installed a new plugin or theme, it might conflict with another tool on your site, prompting a 502 gateway error. A recent plugin update might also cause this.

      Since you cannot access your WordPress dashboard, you’ll need to deactivate your plugins and themes from the File Manager in your hosting account. Alternatively, you could use an SFTP client.

      If you’re a DreamHost user, log in to your account and open your site’s File Manager (as shown in the previous step). Then, go to wp-content and look for a folder called plugins:

      The plugins folder in the File Manager

      To deactivate your plugins, all you need to do is rename this folder. However, if you already know which plugin is causing trouble, you can locate it inside the plugins folder and rename its folder instead.

      You can now try accessing your site again. If it’s up and running, log in to the WordPress dashboard and re-activate each plugin one by one while refreshing the page. This process will help you identify the culprit.

      If you know which plugin is causing the 502 gateway error, we recommend removing it from your site or disabling it until the developers release a fix. You’ll just need to repeat the same process to deactivate your themes.

      Don’t worry if you’re still having issues after deactivating your plugins and themes— there are still a couple more things you can try.

      6. Disable Your CDN or Firewall

      The 502 gateway error could also be caused by your Content Delivery Network (CDN) or firewall. If you’re using Cloudflare, you can simply check to see if there are any reported issues.

      For example, the server might be undergoing scheduled maintenance:

      The Cloudflare System Status page

      Alternatively, try disabling the CDN to see if it resolves the issue. If you’re using a firewall, you might also want to deactivate it.

      You should be able to manage your CDN and firewall from your hosting account dashboard. If you’re unsure where to find these settings, we recommend contacting your web host for assistance.

      7. Restart PHP and Increase Your PHP Limits

      The 502 gateway error could also be caused by a PHP timeout issue. This happens when the PHP process takes longer than the maximum load time and the request times out.

      First, you might want to try restarting PHP. This could help resolve any connectivity issues. If this option is unavailable in your hosting dashboard, you might want to ask your web host to do it for you.

      Alternatively, you might need to change your server’s max_execution_time or max_input_time values. By default, these are set to 300 seconds. However, you can ask your web host to increase these values.

      8. Contact Your Hosting Provider

      If none of the above steps help solve your problem, you should consider contacting your hosting provider. They might be experiencing a server issue that’s affecting your site. If that’s the cause, there’s nothing you can do but wait.

      Additionally, they might be able to identify the source of the 502 gateway error and walk you through a solution. Most web hosts offer 24/7 support, so they should be able to resolve the issue quickly!

      Solve the 502 Bad Gateway Error

      The 502 gateway error is usually caused by an issue with the server. For instance, it might have experienced a spike in traffic that affected its performance and availability. However, this error could also be triggered by plugin conflicts and updates.

      To troubleshoot the problem, start by clearing your browser cache and local DNS cache to rule out any issues on your end. Then, you can try disabling your plugins, themes, CDN, and firewall. If you’re still experiencing problems, consider contacting your hosting provider for assistance.

      At DreamHost, our WordPress hosting plans come with 24/7 ticket support and live chat support. Our team of experts can help you resolve technical problems and get your site up and running again. Learn more about our plans!

      Do More with DreamPress

      DreamPress Plus and Pro users get access to Jetpack Professional (and 200+ premium themes) at no added cost!

      Managed WordPress Hosting - DreamPress

      Source link

      Hreflang Tags: Your Gateway to International SEO

      Continually working to optimize your website for search engine visibility will ensure that new users can find your website on the web. There are a range of techniques you can use to improve your website’s SEO rankings for a national audience, however when trying to target audiences in multiple countries or visitors who speak more than one language, you’ll need to follow a few additional rules — one of which involves adding hreflang tags to your website.

      Search engines read hreflang tags to ensure that your pages are indexed correctly for a defined international audience, and that those users are directed to the correct versions of your site. Fortunately, there are a handful of relatively simple, easy methods you can use to insert and leverage these attributes on your website.

      In this post, we’ll introduce you to hreflang tags and explain why they’re important. Then we’ll walk you through how you can implement them on your website. Let’s jump in!

      An Introduction to Hreflang Tags

      First introduced by Google in 2011, the hreflang attribute specifies the language of the content on a page.

      You can use hreflang tags to target specific countries. They are handy for websites offering content in multiple languages.

      Hreflang tags are added to the <head> section of your web pages’ HTML code. Each tag should specify the language and country for a particular page.

      For instance, the tags might look similar to the following:

      <link rel="alternate" hreflang="x-default" href="">
      <link rel="alternate" hreflang="en" href="">
      <link rel="alternate" hreflang="de" href="">

      In the above example, the first line is the default page for users who don’t speak any of the languages specified. The second and third lines are for English and German speakers, respectively. The hreflang attribute specifies the language, and the href attribute specifies the URL.

      It’s important to note that hreflang tags are only used by search engines — they won’t be visible to users. Furthermore, hreflang tags are just one type of tag that can improve your website’s SEO and User Experience (UX). Other common tags include title tags and meta descriptions.

      Also, keep in mind that hreflang tags and canonical tags are not the same. A canonical tag is an HTML element that tells search engines which version of a page to index.

      A hreflang tag, on the other hand, tells search engines which version of a page to serve to users in different countries. Canonical tags solve duplicate content issues. By contrast, hreflang tags ensure that users who speak different languages are served the correct page versions.

      Why Hreflang Tags Are Important

      Hreflang tags are important for a handful of reasons. They affect both the UX and SEO of your website.

      Benefits of Using Hreflang Tags

      • Ensure that your pages are indexed correctly.
      • Direct users to the correct versions of your site.
      • Lead to higher traffic levels and more conversions.
      • Organize your website.
      • Localize your content for global users.
      • Prevent competition between alternate web pages.

      In addition, hreflang tags can improve your Click-Through Rate (CTR) from Search Engine Result Pages (SERPs). Users who see your site is available in their languages are more likely to click on it. This can lead to higher traffic levels and, ultimately, more conversions.

      How to Use Hreflang Tags (3 Technical Methods)

      There are three main methods for implementing the hreflang attribute on your website. Below, we’ll walk you through each one.

      However, regardless of your chosen method, it’s important to understand three basic elements of hreflang tags. First, the language attribute must be in a two-letter country code known as the ISO 639-1 format. ISO is short for International Organization for Standardization. This value consists of one language, and can be combined with an (optional) region.

      You can use the ISO 3166-1 region codes to specify a region. It’s important not to get the two confused or use them interchangeably. For example, the code for the Greek language is “el”, but the code for the Greece region is “gr”.

      The second rule is that each URL needs to have return links pointing to the canonical versions. For instance, if you have 40 languages, you would have hreflang links for 40 URLs.

      Finally, you need self links for your hreflang tag implementation to work. This means that each language version must also list itself using a self-referential hreflang tag, which the page points back to itself.

      Now, here are three methods for using hreflang tags!

      1. Use HTML Tags in <head> Sections

      As we mentioned earlier, one of the ways to implement hreflang tags on your website is to insert them in HTML tags. This is often the quickest and easiest method.

      However, this process can be time-consuming if you have a long list of languages. You would need to link each variation to every other variation. Additionally, WordPress would have to make multiple database calls to generate these links.

      Ultimately, this could slow down your site. Therefore, if you have a larger website or want to create a long list of languages, you might want to use the sitemap method instead (see Method 3).

      To use this HTML tag method, you must insert your hreflang tags into the <head> section of each of your pages. For instance, if you wanted to add English and Spanish versions for the United States version of your site, you would add the following code:

      <link rel="alternate" hreflang="x-default" href="">
      <link rel="alternate" hreflang="en" href="">
      <link rel="alternate" hreflang="es" href="">

      In the above example, the first line refers to the default page. The second and third are for English and Spanish speakers.

      2. Insert Hreflang Tags in Your HTTP Headers

      If you want to add hreflang tags in non-HTML pages, such as PDFs, you won’t have HTML code to place the tags in. When this is the case, you can use your HTTP headers instead.

      The code would look something like the following:

      <http://example.pdf>; rel="alternate";hreflang="x-default",
      <http:/example.pdf>; rel="alternate";hreflang="en",
      <http://example.pdf>; rel="alternate";hreflang="es",
      <http://example.pdf>; rel="alternate";hreflang="de"

      In this example, you’re adding variants for English, Spanish, and German. Each of the respective versions must be placed in the headers of each PDF file.

      Get Content Delivered Straight to Your Inbox

      Subscribe to our blog and receive great content just like this delivered straight to your inbox.

      3. Add Hreflang Tags to Your Sitemap

      The third method for implementing hreflang tags is using XML sitemap markup. This approach will let you add the hreflang attributes for all your site’s pages in one place.

      It can also help you avoid slowing down your page loading speed (which might happen if you place the tags in the head section of the pages). Plus, changing a sitemap can be significantly easier than modifying each page’s <head> tag.

      The sitemap method is similar to the HTML <head> tag method, except the xhtml:link attribute adds the hreflang annotations to each URL. Following the xhtml:link attribute at the front of your URL, you would add the alternative page versions, so your markup would look similar to the following:

      <xhtml:link rel=”alternate” hreflang=”en-us” href=”x-default”
      <xhtml:link rel=”alternate” hreflang=”en” href=”” />
      <xhtml:link rel=”alternate” hreflang=”es” href=”” />

      Here, you’ll see that each URL has a hreflang attribute and return links to the other URLs. A separate <url> element should be created for every URL. Each element must include a <loc> that indicates the page URL. The URLs also need a <xhtml:link rel=”alternate” hreflang=”supported_language-code”> element that lists each alternative version of the page.

      You can add all of the necessary tags to one file. While the order of the elements doesn’t matter, we recommend keeping them uniform, because this layout will make it easier to check for mistakes. You can submit your new sitemap to Google Search Console when you’re done.

      Tools That Generate Hreflang Tags Automatically

      The time it takes to generate and implement your hreflang tags can vary depending on how many versions you want to create and which method you use. However, a handful of tools can simplify and speed up the process. Let’s take a look at some of the most popular ones!

      Weglot Translate Plugin

      Weglot is a popular and reliable translation tool that can add hreflang Google tags and markup to your website:

      The Weglot Translate WordPress plugin

      Weglot can be a helpful solution if you’re a beginner and unfamiliar with working with code. It automatically identifies href tags in your code during translation, and changes the page header links.

      Hreflang Checker

      It’s crucial to always double-check your hreflang tags to ensure that they’re working correctly after you’ve placed them. The Hreflang Checker tool provided by Weglot can help simplify this process:

      The Hreflang Checker tool

      To use it, just copy and paste the URL that you want to check into the text field (make sure to include “http://” or “https://”) and select a search engine bot to emulate. Then click on the Test URL button. It will display a search results page showing your tags’ status.

      XML Sitemap Generator

      If you want to implement hreflang tags using the sitemap method, you can utilize the Hreflang XML Sitemap Generator Tool. It was created by Erudite, a digital marketing agency:

      The Erudite Hreflang Sitemap tool

      After creating an account using your email address, simply tell the tool where to send your sitemap and upload your CSV file, including a column for each language. Then Erudite’s tool will automatically generate an XML sitemap.

      Hreflang Tags Generator

      If you need help generating the link elements for your hreflang tags, you can use the Hreflang Tags Generator:

      the Hreflang Tags Generator tool

      This tool, created by Aleyda Solis, can streamline creating tags for your multi-language or multi-country website. You can generate these tags by either adding the (up to 50) URLs to tag in the given form, or uploading them via a CSV file. Again, you’ll need to make sure that there is one column for the URLs.

      Ahrefs Google Sheets Template

      Another tool that you can use is the Google Sheets template provided by Ahrefs:

      The Hreflang planner Google Sheets template

      Under the Setup tab, select your site’s language-locale (default language), then choose up to four additional variations. For instance, you could pick English as the Default language-locale, followed by Spanish, German, Chinese, and Russian as the alternatives.

      Next, under the URLs tab, you’ll find five columns, each with its own header cells that correspond to the language you chose in the Setup tab. There should also be an X-Default column.

      Now paste the URLs into the respective cells. Then, under the Results tab, you’ll find an auto-generated code for your XML sitemap. You can copy and paste everything in the A column into an XML document and upload it via Google Search Console.

      Tips and Best Practices for Using Hreflang Tags

      Now that you understand the basics of hreflang tags and their implementation, let’s discuss some tips for using them. Below are some key best practices to follow!

      Make Sure the Tags Are Bidirectional

      Hreflang tags operate in pairs, meaning that they are bidirectional. When you add a hreflang tag to an English page pointing to a Spanish version, you also need to ensure that the Spanish variant returns with a hreflang tag pointing to the English version.

      This setup tells search engines the relationship is in agreement, and that you control both pages. If two pages don’t point to each other, Google will ignore the tags.

      Specify the Default Page for Users Who Don’t Speak Any of the Specified Languages

      Specifying the default page for users who don’t speak any of your set languages is important. It will ensure that visitors are directed to the correct version of your site.

      You can do this by adding a tag with the language code “x-default”. It would look something like:

      <link rel=”alternate” hreflang=”x-default” href=”” />

      The default page will be used in situations where Google is unable to extract the language or region for users when it’s not specified or listed. Instead, the x-default page will ask users which language they prefer, then point them to the appropriate alternate version.

      Use Absolute URLs

      Absolute URLs are complete URLs that include the domain name. They are also the preferred type of URL to use with hreflang tags. They are less likely to be affected by changes on your website, and make it easier for search engines to index your pages correctly.

      It’s important to make sure that your hreflang tags contain absolute URLs. In other words, the code should look like “” rather than “”.

      Make Sure Your Hreflang Tags Are Valid and Correctly Formatted

      As we mentioned earlier, the correct ISO language and region codes must be used when creating your hreflang link attributes. Otherwise, you may encounter a message in Google Search Console informing you that your site doesn’t have any hreflang language tags.

      Remember to use the ISO language codes for language attributes and the region codes for geographical locations. For instance, while “kr” is for the region of South Korea, “ko” is the code for the Korean language.

      Keep Your Hreflang Tags Up To Date

      As you continue adding content and pages to your website, keeping up with your hreflang tags becomes more critical.

      Let’s say you add a new domain for a particular country. Then you’ll need to add the appropriate hreflang tags to your existing pages, and check to ensure that they point to the new domain.

      The same applies if you delete any language versions of your website. If you remove a language, you’ll need to delete or replace the hreflang tags pointing to it. Pointing to missing or incorrect URLs can hurt both your UX and SEO.

      Monitor Your Website for Errors

      Just as essential as keeping your hreflang tags updated is consistently monitoring your website for errors. This process includes checking your site’s source code to make sure that all necessary tags are present.

      You can use a tool such as Google Search Console to monitor your website more easily. This platform will help you verify whether your pages are being indexed correctly.

      Optimize Your Website for International Audiences

      Using hreflang tags can improve the SEO and UX of your website for international audiences. These attributes can help your site reach users in different countries, and ensure that the correct content is served in their native or preferred languages.

      As we discussed in this article, there are three methods you can use to implement hreflang tags:

      1. Add the attributes to the <head> section of each page.
      2. Place them in the HTTP headers of non-HTML content pages.
      3. Put the tags in your XML sitemap, so that all the attributes are in one place.

      Do you need help optimizing your multilingual website? Check out our DreamHost Pro Services to learn how we can take your site to the next level!

      International SEO Made Easy

      We take the guesswork (and actual work) out of growing your website traffic with SEO.

      shared hosting

      Source link

      Building an API Gateway to Get Out of the Monoliths

      How to Join

      This Tech Talk is free and open to everyone. Register below to get a link to join the live event.

      Presentation and Q&AOctober 15, 2020, 12:00–1:00 p.m. ET

      If you can’t join us live, the video recording will be published here as soon as it’s available.

      About the Talk

      As DigitalOcean grew, we got to a point where we couldn’t force all teams (now dozens of developers) to work on the same monoliths. We needed a solution that wouldn’t throw away all the investment that had already been made, but that would allow teams to get up and running fast with new applications without reinventing everything.

      We’ll discuss why we decided to go the API gateway route, the challenges we had to overcome along the way, the mistakes we’ve made and how you can avoid them when adding an API gateway to your microservices architecture or when you want to start to move away from monoliths.

      What You’ll Learn

      • What is an API gateway and how you can use it.
      • The challenges the Edge team at DigitalOcean had to overcome to make sure the migration into microservices wasn’t as bad as staying in the monolith.
      • The importance of communication and self-service solutions for infrastructure.

      This Talk is Designed For

      Developers that are starting to think about microservices or that are already running on microservices-based architectures and would like to get a better idea on what and how they can use API Gateways.


      An understanding of HTTP-based APIs.

      About the Presenter

      Maurício Linhares is a Senior Engineer on the Edge Team at DigitalOcean and was involved in building our API gateway from its beginnings. He’s passionate about distributed and functional programming, DevOps, and building infrastructure.

      To join the live Tech Talk, register here.

      Source link