Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 2896e3b

Browse files
meker12Barny ShergoldNadiyaS
authored
MCLOUD-6977: Update documentation about routes (magento#7912) (magento#7927)
* MCLOUD-6977: Update documentation about routes * Update src/cloud/project/routes.md Co-authored-by: Margaret Eker <[email protected]> Co-authored-by: Barny Shergold <[email protected]> Co-authored-by: Nadiya Syvokonenko <[email protected]>
1 parent c1d836c commit 2896e3b

File tree

1 file changed

+56
-31
lines changed

1 file changed

+56
-31
lines changed

src/cloud/project/routes.md

Lines changed: 56 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@ redirect_from:
88
- /cloud/project/project-conf-files_routes.html
99
---
1010

11-
The `routes.yaml` file in the `.magento/routes.yaml` directory defines routes for your {{ site.data.var.ece }} Integration, Staging, and Production environments. Routes determine how Magento processes incoming HTTP requests.
11+
The `routes.yaml` file in the `.magento/routes.yaml` directory defines routes for your {{ site.data.var.ece }} Integration, Staging, and Production environments. Routes determine how Magento processes incoming HTTP and HTTPS requests.
1212

1313
{% include cloud/note-pro-missing-self-service-options.md %}
1414

15-
The default `routes.yaml` file specifies the route templates for processing HTTP requests on projects that have a single default domain and on projects configured for multiple domains:
15+
The default `routes.yaml` file specifies the route templates for processing HTTP requests as HTTPS on projects that have a single default domain and on projects configured for multiple domains:
1616

1717
```yaml
1818
"http://{default}/":
@@ -23,8 +23,6 @@ The default `routes.yaml` file specifies the route templates for processing HTTP
2323
upstream: "mymagento:http"
2424
```
2525
26-
If you do not create a custom `routes.yaml` file, the automated deployment uses the default file.
27-
2826
Use the `magento-cloud` CLI to view a list of the configured routes:
2927

3028
```bash
@@ -42,27 +40,25 @@ magento-cloud environment:routes
4240

4341
The `routes.yaml` file is a list of templated routes and their configurations. You can use the following placeholders in route templates:
4442

45-
- `{default}` represents the qualified domain name configured as the default for the project. For example, if you have a project with the default domain `example.com`, the route templates `http://www.{default}/` and `https://{default}/blog` resolve to the following URLs in a production environment:
43+
- `{default}` represents the qualified domain name configured as the default for the project. For example, if you have a project with the default domain `example.com`, the route templates `https://www.{default}/` and `https://{default}/blog` resolve to the following URLs in a production environment:
4644

4745
```text
48-
http://www.example.com/
46+
https://www.example.com/
4947
50-
https://www.example.com/blog
48+
https://example.com/blog
5149
```
5250
{:.no-copy}
5351

54-
In a non-production branch, the project ID and environment ID replace the `{default}` placeholder when the project is deployed.
55-
56-
- `{all}` represents all the domain names configured for the project. For example, if you have a project with `example.com` and `example1.com` domains, the route templates `http://www.{all}/` and `https://{all}/blog` resolve to routes for all domains in the project:
52+
- `{all}` represents all the domain names configured for the project. For example, if you have a project with `example.com` and `example1.com` domains, the route templates `https://www.{all}/` and `https://{all}/blog` resolve to routes for all domains in the project:
5753

5854
```text
59-
http://www.example.com/
60-
61-
http://www.example.com/blog
55+
https://www.example.com/
6256
6357
https://www.example1.com/
6458
65-
https://www.example1.com/blog
59+
https://example.com/blog
60+
61+
https://example1.com/blog
6662
```
6763
{:.no-copy}
6864

@@ -73,21 +69,49 @@ The `routes.yaml` file is a list of templated routes and their configurations. Y
7369
{{site.data.var.ee}} also generates routes for every active Integration environment. For Integration environments, `{default}` is replaced with the following domain name:
7470

7571
```text
76-
[branch]-[project-id].[region].magentosite.cloud
72+
[branch]-[per-environment-random-string]-[project-id].[region].magentosite.cloud
7773
```
7874
{:.no-copy}
7975

80-
For example, the `refactorcss` branch for the `mswy7hzcuhcjw` project hosted in the `us` cluster has the following the domains:
76+
For example, the `refactorcss` branch for the `mswy7hzcuhcjw` project hosted in the `us` cluster has the following the domain:
8177

8278
```text
83-
http://www-refactorcss-mswy7hzcuhcjw.us.magentosite.cloud/
84-
85-
https://refactorcss-mswy7hzcuhcjw.us.magentosite.cloud/blog
79+
https://refactorcss-oy3m2pq-mswy7hzcuhcjw.us.magentosite.cloud/
8680
```
8781
{:.no-copy}
8882

8983
{:.bs-callout-info}
90-
{{site.data.var.ece}} also supports [multiple applications]({{ site.baseurl }}/cloud/project/project-multi-sites.html) per project. Each project has a single `routes.yaml` file that defines which request is routed to which application.
84+
If your Cloud project supports multiple stores, follow the route configuration instructions for [multiple websites or stores]({{ site.baseurl }}/cloud/project/project-multi-sites.html).
85+
86+
## Route protocols
87+
88+
All environments support both HTTP and HTTPS automatically.
89+
90+
- If the configuration specifies only the HTTP route, HTTPS routes are created automatically, allowing the site to be served from both HTTP and HTTPS without requiring redirects. For example, if you have project with the default domain `example.com`, the record `http://{default}/` resolves to the following URLs:
91+
92+
```text
93+
http://example.com/
94+
95+
https://example.com/
96+
```
97+
{:.no-copy}
98+
99+
- If the configuration specifies only the HTTPS route, then all HTTP requests redirect to HTTPS. For example, for the default domain `example.com`, the route `https://{default}/` resolves to URL `https://example.com/` and redirects `http://example.com/` to `https://example.com/`.
100+
101+
We recommend serving all pages over TLS. For this configuration, you must configure redirects for all unencrypted request to the TLS equivalent using one of the following methods:
102+
103+
- Change protocol to HTTPS in `routes.yaml`.
104+
105+
```yaml
106+
"https://{default}/":
107+
type: upstream
108+
upstream: "mymagento:http"
109+
"https://{all}/":
110+
type: upstream
111+
upstream: "mymagento:http"
112+
```
113+
114+
- For Staging and Production environments, we recommend enabling the [Force TLS on Fastly](https://support.magento.com/hc/en-us/articles/360006296953-Redirect-HTTP-to-HTTPS-for-all-pages-on-Cloud-Force-TLS-) option from the Magento Admin UI. When you use this option, Fastly handles the redirection to HTTPS, so you do not have to update the `routes.yaml` configuration.
91115

92116
## Route options
93117

@@ -103,31 +127,35 @@ Property | Description
103127

104128
## Simple routes
105129

106-
The following sample routes the apex domain and the `www` subdomain to the `frontend` application. This route does not redirect HTTPS requests:
130+
In the following examples, the route configuration routes the apex domain and the `www` subdomain to the `mymagento` application. This route does not redirect HTTPS requests.
131+
132+
**Example 1:**
107133

108134
```yaml
109135
"http://{default}/":
110136
type: upstream
111-
upstream: "frontend:http"
137+
upstream: "mymagento:http"
112138
113139
"http://www.{default}/":
114140
type: redirect
115141
to: "http://{default}/"
116142
```
117143

118-
The following sample route does not redirect from the `www` to the apex domain; instead, it serves from both:
144+
In the following example, the route configuration does not redirect URLs from the www domain to the apex domain. Instead, requests are served from both the www and apex domain.
145+
146+
**Example 2:**
119147

120148
```yaml
121149
"http://{default}/":
122150
type: upstream
123-
upstream: "frontend:http"
151+
upstream: "mymagento:http"
124152
125153
"http://www.{default}/":
126154
type: upstream
127-
upstream: "frontend:http"
155+
upstream: "mymagento:http"
128156
```
129157

130-
In the first sample, the server responds directly to a request of the form `http://example.com/hello`, but it issues a _301 redirect_ for `http://www.example.com/mypath` (to `http://example.com/mypath`).
158+
In this example, the server responds directly to a request of the form `http://example.com/hello`, issuing a _301 redirect_ for requests with the URL pattern `http://www.example.com/mypath`. These requests redirect to the apex domain, for example `http://example.com/mypath`.
131159

132160
## Wildcard routes
133161

@@ -170,10 +198,7 @@ See more information about [caching]({{ site.baseurl }}/cloud/project/project-ro
170198
As discussed in more detail in [Redirects]({{ site.baseurl }}/cloud/project/project-routes-more-redir.html), you can manage complex redirection rules, such as *partial redirects*, and specify rules for route-based [caching]({{ site.baseurl }}/cloud/project/project-routes-more-cache.html):
171199

172200
```yaml
173-
http://www.{default}/:
174-
type: redirect
175-
to: https://{default}/
176-
http://{default}/:
201+
https://www.{default}/:
177202
type: redirect
178203
to: https://{default}/
179204
https://{default}/:
@@ -187,5 +212,5 @@ https://{default}/:
187212
ssi:
188213
enabled: false
189214
type: upstream
190-
upstream: php:http
215+
upstream: mymagento:http
191216
```

0 commit comments

Comments
 (0)