I've an EC2 machine which is behind a ALB. Listener rules in the ALB are like
IF
Path is/blog*
Host is abc.example.com
THEN
Forward to
target-group-1
My nginx config looks like this:
##
# Default server configuration
server {
listen 80 default_server;
listen [::]:80 default_server;
root /var/www/html;
# Add index.php to the list if you are using PHP
index index.html index.htm index.nginx-debian.html;
server_name _;
location /blog {
proxy_pass https://abc.webflow.io/;
}
}
Main page opens fine at abc.example.com/blog
but embedded links are not opening and giving 502 bad gateway when opened through DNS defined in ALB listener rules and when directly opened using EC2 instance IP are giving 404 not found
When I click on embedded links inside the main page, URL in the browser shows abc.example.com/categories/something/
and gives the above HTTP codes but if I manually edit the url in the browser and type it as: abc.example.com/blog/categories/something/ then page opens fine.
I'm trying to find how to rewrite the URL in such a way that it contains the sub-folder name as well but can't find anything.
Any help will be great!