skip to Main Content

I have this file:

.ebextensions/nginx/conf.d/rewrite.config

files:
  "/etc/nginx/conf.d/rewrite.config":
    mode: "000755"
    owner: root
    group: root
    content: |
      location / {
          error_log "Rewrite rule triggered for URL: $uri" info;
          rewrite ^([^#]*)%23(.*)$ $1#$2 permanent;
      }


When I deploy this to Elastic Beanstalk using eb deploy, then make requests to the web app, this part is not triggered.

Is the code above correct? What am I doing wrong?

Note: Purpose of code is to replace %23 with #

2

Answers


  1. Chosen as BEST ANSWER

    Here's what I have discovered yesterday and ended up working for me.

    Create this file:

    .platform/nginx/conf.d/elasticbeanstalk/00_application.conf
    

    This way you can override the default / block. Other solutions didn't work.

    Hope this helps me and other people in the future!


  2. If your environment is based on a platform built on top of the AWS AMI 2 image, put your nginx config in this directory :

    .platform/nginx/conf.d/rewrite.conf

    More info here

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search