title: Hosting Docusaurus v2 using Nginx
body: <p>I'm attempting to use nginx as the reverse proxy to host Docusaurus v2 on Google AppEngine.
  GooglAppEngine has HTTPS turned on. And Nginx listens on port 8080. Hence by default all requests are over HTTPS and the connections managed by Google AppEngine.</p>
  <p>However, I'm having an issue when users perform the following actions :</p>
  <ul>
  <li>Reach the landing page</li>
  <li>Go to documentations (any page).</li>
  <li>Refresh the page.</li>
  </ul>
  <p>The user is getting directed to port 8080 and not the https site of docusaurus.</p>
  <p>Without refreshing the page, the user is able to successfully navigate the site. It's when the user hits a refresh button that they get the redirect. Looking at the header information, I see the response pointing them to port 8080 but I'm not sure why that is happening.</p>
  <p>Wondering if anyone has successfully been able to set up Docusaurus v2 with nginx ?</p>
  <p>My config for nginx is as follow :</p>
  <pre><code>events {
      worker_connections 768;
  }
  
  http {
      sendfile on;
      tcp_nopush on;
      tcp_nodelay on;
      keepalive_timeout 65;
      types_hash_max_size 2048;
      include /etc/nginx/mime.types;
      default_type application/octet-stream;
  
      # Logs will appear on the Google Developer's Console when logged to this
      # directory.
      access_log /var/log/app_engine/app.log;
      error_log /var/log/app_engine/app.log;
  
      gzip on;
      gzip_disable &quot;msie6&quot;;
  
      server {
          # Google App Engine expects the runtime to serve HTTP traffic from
          # port 8080.
          listen 8080;
          root /usr/share/nginx/www;
          index index.html index.htm;
          location / {
          if ($http_x_forwarded_proto = &quot;http&quot;) {
          return 301 https://$server_name$request_uri;
              }
          }
          
  
  
      }
  </code></pre>