Help:Using a web proxy to reach Cloud VPS servers from the internet

From Wikitech
(Redirected from Help:Proxy)
Jump to navigation Jump to search

This page describes how to create a simple web proxy for a Cloud VPS instance.

For reaching the internet from production servers, see HTTP proxy.

Before you begin

Before you begin, you must:

Benefits

  • Ensures that TLS encryption is used between the front proxy and the client.
  • Saves an IPv4 address and instead uses a name-based vhost. IPv4 addresses are a precious commodity in the modern internet.
  • Protects both the end user and your Cloud VPS project from leaking the client IP address which is considered personally identifiable information by the Wikimedia Foundation by hiding the client IP address from your service.

Limitations

  • TLS encryption between the proxy and your upstream service is not currently supported. Requests from the frontend to your upstream will however include a X-Forwarded-Proto: https header that your software stack can use to determine that TLS encryption with the client has been handled already.

Creating a web proxy

  1. Go to https://horizon.wikimedia.org/
  2. Select your project.
  3. Click "DNS" in the left navigation menu.
  4. Click "Web Proxies" inside the expanded "DNS" section of the left navigation menu.
  5. Click the "Create Proxy" button in the upper right of the page.
  6. In the "Hostname" field, enter the hostname that you wish to have as the publicly-visible name for your instance. Important: Enter just the hostname (e.g. 'webtastic'), not the fully qualified name (e.g. 'webtastic.wmcloud.org').
  7. Specify the domain for your instance using the “Domain” selector. If you want a domain that is not already present in the menu, a cloud admin (most likely a staff member) will need to create it for you.
  8. Select the instance that you're creating a proxy for in the “Backend Instance” selector.
  9. Enter the “Backend port” that the proxy should connect to on your instance. This will probably be either the default value of 80 if you are running a normal web server or 8080 if you are using MediaWiki-Vagrant.
  10. Click “Create proxy”.

An entry for the new web proxy should appear in the proxy table.

Security groups

You may need to update your security group settings before you can access the instance on an external browser.

Some projects have setup a 'web' security group to make this easier or already added the common 80 and 8080 ports to their default security group.

  1. In the left-hand navigation, open "Network", then "Security Groups" section and select the project you want to make available externally.
  2. Add a new rule to open up your proxied port for outside access.
  3. Set the start and end port in the rule form to the value you entered for “Backend port” when creating the proxy.
  4. Select "tcp" as the protocol
  5. CIDR range: 172.16.0.0/21
  6. Click "Submit"

You may also have to apply this new (or existing) security group to the instance you want to make available: navigate to "Instances" (in the "Compute" section) and select "Edit Security Groups" from the "Actions" menu of the appropriate instance.

Delete unused web proxies

Once your instance is no longer in use, make sure to delete the unused web proxy.

Migrate from a *.wmflabs.org proxy to a *.wmcloud.org proxy

Since 2020-07-06, newly created proxies use the wmcloud.org domain by default instead of the legacy wmflabs.org domain. Projects which have been using a *.wmflabs.org proxy can migrate to a *.wmcloud.org proxy by following these steps:

  1. Create a new *.wmcloud.org proxy pointing to your backend service
  2. Test your service using the new hostname while the related *.wmflabs.org proxy still exists
  3. Once you are ready to redirect all traffic to the *.wmcloud.org hostname, just delete the legacy *.wmflabs.org proxy. The Cloud VPS HTTP proxy service will automatically issue a redirect from <host>.wmflabs.org to <host>.wmcloud.org when there is no existing proxy for <host>.wmflabs.org.

Troubleshooting

There are two reasons why web pages cannot be served by a default Cloud VPS instance:

  1. Instances are closed off from outside networks with a firewall. You must open holes in the firewall by editing the security groups for your project.
  2. Instances are assigned private IP addresses that are only visible from within Cloud VPS. This can be addressed by assigning your instance a public IP or by creating a web proxy.

Communication and support

Support and administration of the WMCS resources is provided by the Wikimedia Foundation Cloud Services team and Wikimedia movement volunteers. Please reach out with questions and join the conversation:

Discuss and receive general support
Receive mail announcements about critical changes
Subscribe to the cloud-announce@ mailing list (all messages are also mirrored to the cloud@ list)
Track work tasks and report bugs
Use the Phabricator workboard #Cloud-Services for bug reports and feature requests about the Cloud VPS infrastructure itself
Learn about major near-term plans
Read the News wiki page
Read news and stories about Wikimedia Cloud Services
Read the Cloud Services Blog (for the broader Wikimedia movement, see the Wikimedia Technical Blog)