0
votes

We are having separate App Engine service that sharing static content through nginx server. Such scheme required to enabled react routing, so we are returning index.html on business logic routes. Nginx lays inside docker container and listens port 8080, that was required and used in App Engine example app.

I've checked out the instance on which container is running and actually two ports are in use with my container: 80 and 8080.

All requests going to static content by default. I believe that it is all about nginx configuration, so, here is the questions.

  1. Are they actually used like 80 -> 80 and 8080 -> 443? In this case I would just create separate standard server which listens port 80 and redirects to https version.
  2. If port 80 actually not used, then does it mean that all traffic, both http and https coming through single 8080 port?
  3. Will solution through if statement and regexp matching http in url request work? How awful this would be as a solution?
1

1 Answers

4
votes

Both HTTP and HTTPS traffic arrive in the App Engine Flexible runtime on port 8080. The X-Forwarded-Proto HTTP header will contain either http or https, you should use this to determine which protocol the client is using.

You can even do it directly within the nginx configuration, as shown in this answer.