Skip to content

Be able to run AnsibleForms behind a reverse proxy (as a NGINX) and serving it from a sub path (not at webroot level). #106

@dariopai

Description

@dariopai

Is your feature request related to a problem? Please describe.
Ansibleform not working well behind a reverseproxy and being served from a subpath

Describe the solution you'd like
Defined the subpath in settings as in the case of Grafana => https://grafana.com/tutorials/run-grafana-behind-a-proxy/

Describe alternatives you've considered

Working on version: v4.0.10

When using nginx it can be managed using sub_filter & proxy_intercept_errors as below settings:

------nginx.con------

map $upstream_http_location $redirect_uri {
~azuretoken(.) https://host.domain.local/myAnsibleforms/#/login?azuretoken$1;
default $upstream_http_location;
}

location /myAnsibleforms/ {
proxy_pass https://10.1.1.1:8445/;
proxy_redirect off;
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 https ;
sub_filter 'href: "/"' 'href: "/myAnsibleforms/"';
sub_filter '<title>Ansible Forms</title>' '<title>myAnsibleforms</title>';
sub_filter /css/ /myAnsibleforms/css/;
sub_filter /js/ /myAnsibleforms/js/;
sub_filter /api/ /myAnsibleforms/api/;
sub_filter /assets/img/logo_ansible_forms_full_white.svg /myimages/logo_custom.jpg;
sub_filter /assets/ /myAnsibleforms/assets/;
sub_filter /favicon.svg /myAnsibleforms/favicon.svg;
sub_filter 'myAnsibleforms/myAnsibleforms' 'myAnsibleforms';
sub_filter_once off;
sub_filter_types *;
proxy_intercept_errors on;
error_page 302 = @reDIrect;
}
location @reDIrect {
return 302 $redirect_uri;
}

Additional context
n/a

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions