Configuring the proxy server for your .NET Core on Linux environment - Amazon Elastic Beanstalk
Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions, see Getting Started with Amazon Web Services in China (PDF).

Configuring the proxy server for your .NET Core on Linux environment

Amazon Elastic Beanstalk uses nginx as the reverse proxy to relay requests to your application. Elastic Beanstalk provides a default nginx configuration that you can either extend or override completely with your own configuration.

By default, Elastic Beanstalk configures the nginx proxy to forward requests to your application on port 5000. You can override the default port by setting the PORT environment property to the port on which your main application listens.

Note

The port that your application listens on doesn't affect the port that the nginx server listens on to receive requests from the load balancer.

Configuring the proxy server on your platform version

All AL2023/AL2 platforms support a uniform proxy configuration feature. For more information about configuring the proxy server on your platform versions running AL2023/AL2, expand the Reverse Proxy Configuration section in Extending Elastic Beanstalk Linux platforms.

The following example configuration file extends your environment's nginx configuration. The configuration directs requests to /api to a second web application that listens on port 5200 on the web server. By default, Elastic Beanstalk forwards requests to a single application that listens on port 5000.

Example 01_custom.conf
location /api { proxy_pass http://127.0.0.1:5200; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection $http_connection; proxy_set_header Host $host; proxy_cache_bypass $http_upgrade; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; }