Remove subpath (context bonita) in nginx or apache

1
0
-1

Hello,
I'm having trouble removing path /bonita from the url

I try with two ways APCHE or NGINX result is the same

````


ServerName bonita.befirst.com

ErrorLog ${APACHE_LOG_DIR}/bonita_befirst_com/error.log
CustomLog ${APACHE_LOG_DIR}/bonita_befirst_com/access.log combined

RewriteEngine on
RewriteRule "^(?!/bonita)(.*)$" "/bonita$1" [R,L]
RewriteRule "^/(.*)" "http://127.0.0.1:8080/$1" [P]

ProxyRequests Off
ProxyPreserveHost on

ProxyPass /bonita/ http://127.0.0.1:8080/bonita/
ProxyPassReverse /bonita/ http://127.0.0.1:8080/bonita/


Order deny,allow
Allow from all


Order allow,deny
Allow from all


````
Or nginx

````

upstream tomcat {
server 127.0.0.1:8080 weight=1 ;
}

server {
listen 0.0.0.0:80;
server_name localhost;

location / {
add_header Requested-URI "$request_uri" always;
add_header Final-URI "$uri" always;
proxy_pass http://tomcat;
rewrite ^(?!/bonita)(.*)$ /bonita$1 break;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;

client_max_body_size 100m;
proxy_buffering off;

}

# redirect server error pages
error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}

access_log /var/log/nginx/bcompliance.com-access.log main;
error_log /var/log/nginx/bcompliance.com-error.log warn;
}

````

Any help is welcome

Tout aide sera la bienvenue

No answers yet.
Notifications