What is AAM?
Alternate Access mapping is a Service, which helps SharePoint, that receives a request to the Web Application with an internal URL to one of the five zones to return the pages, which contain links to the public URL. Many internal URLs can be associated with a single public URL.
Let’s say, your Website has the URL www.sharepoint.com, which is a public URL given to the external users. Now imagine your Website is served by the two internal Servers (that are load balanced) and the internal URL’s would be http://server1.sharepoint.com and http://server2.sharepoint.com, which should be hidden from the external users. Whenever any internal user tries to access the site with any of these internal URL's, it would be redirected to www.sharepoint.com, which is a public URL. AAMs allow SharePoint to replace those links with the public URL.
As per Microsoft,
A reverse proxy is a device that sits between end users and your Web server. All requests to your Web server are first received by the reverse proxy device and, if those requests pass the proxy's security filtering, the proxy forwards the requests to your Web server. Reverse proxies can perform advanced functionality, such as receiving a Web request over the Internet by using HTTPS (Hypertext Transfer Protocol over Secure Socket Layer), but forward the request to the server by using HTTP. This is referred to as "off-box SSL termination."
Note
Some reverse proxy devices can modify the path of a request (the portion of the URL that comes after the hostname and port number) in such a way that a request sent by the user to http://www.contoso.com/sharepoint/default.aspx, for example, is forwarded to the Web Server as http://sharepoint.perimeter.example.com/default.aspx.
This is referred to as an asymmetrical path. Microsoft Office SharePoint Server 2007 does not support asymmetrical paths. The path of the URL must be symmetrical between the public URL and the internal URL. In the preceding example, this means that the "/sharepoint/default.aspx" portion of the URL must not be modified by the reverse proxy device.
Source https://technet.microsoft.com/en-us/library/cc261814(v=office.12).aspx
Internal URL
Internal URL is the HTTP get request received by the Server (IIS), who is hitting Server1.
Eg http://server1.sharepoint.com
Adding alternate access mappings
Open Central Administration - Application Management - Configure Access Mappings?Edit Public URLs?Alternate Access Mapping collection - now, select the zone
How to add an internal URL,
- Go to Alternate Access Mappings page - click Add Internal URL's.
- Now, click Add internal URL section, in the URL protocol, host and port box, type the new internal URL (for example, https://www.sharepoint.com).
- In the Zone list, select the desired zone.
- Click Save.
Public URL
The Server receives the request, builds the page and sends the response to the client with a public URL http://www.sharepoint.com, which would contain all the related links of the particular Website.
Let’s say,
- If you access the about us page of the site, the URL would be http://www.sharepoint.com/pages/aboutus
- The URL, given above is automatically generated, as per the public URL supplied and configured within the Server.
This strategy of hitting the two different Servers with the internal URL's will be used in trouble shooting the targeted Web Server or in the absence of load balancing Server.