On my Ubuntu server, I have installed Odoo at http://localhost:8069; Odoo is a Python application, and serves through a Python server.
When http://localhost:8069 is opened first, Odoo checks for currently logged in user; if there is none, it redirects to http://localhost:8069/web/login ; if there is a logged in user, it redirects to http://localhost:8069/web.
I would thus like to make http://localhost:8069/web available on a subdomain, say http://odoo.myserver.com - so the user does not have to be distracted by the port (the :8069 part) and the subfolder (the /web part). In other words, the user should get the login page as http://odoo.myserver.com/login (instead of http://localhost:8069/web/login).
In my case, http://odoo.myserver.com is on the same computer as the one serving Odoo. So, I thought I'd try a reverse proxy in Apache2 for this. This is my subdomain configuration as a virtual host:
<VirtualHost *:80>
ServerName odoo.myserver.com
ServerAdmin info#myserver.com
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
ProxyRequests Off
ProxyPreserveHost On
<Location />
ProxyPass http://127.0.0.1:8069/web/
ProxyPassReverse http://127.0.0.1:8069/web/
</Location>
ProxyErrorOverride off
</VirtualHost>
When I have this active, and load http://odoo.myserver.com in my browser for the first time, I am redirected to http://odoo.myserver.com/web/login, and I get an Odoo styled 404 "Page not found" page.
If I try without a Location tag, and I map /web local to /web remote:
<VirtualHost *:80>
ServerName odoo.myserver.com
ServerAdmin info#myserver.com
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
ProxyRequests Off
ProxyPreserveHost On
ProxyPass /web/ http://127.0.0.1:8069/web/
ProxyPassReverse /web/ http://127.0.0.1:8069/web/
ProxyErrorOverride off
</VirtualHost>
... then http://odoo.myserver.com simply gives me the default Apache page, and http://odoo.myserver.com/web/ does redirect to http://odoo.myserver.com/web/login (and something similar happens when I map as ProxyPass(Reverse) / http://127.0.0.1:8069/web/) - but this is not what I want.
EDIT: Closest I got to, was by following https://serverfault.com/questions/698995/apache-proxypass-redirect-subdomain-to-port-and-path :
<VirtualHost *:80>
ServerName odoo.myserver.com
ServerAdmin info#myserver.com
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
ProxyRequests Off
ProxyPreserveHost On
ProxyPass / http://127.0.0.1:8069/
ProxyPassReverse / http://127.0.0.1:8069/
RewriteEngine on
RewriteCond %{REQUEST_URI} !^/web
RewriteRule ^/$ /web/$1 [R,L]
ProxyErrorOverride off
</VirtualHost>
... in which case, when I load http://odoo.myserver.com in my browser, I'm redirected to http://odoo.myserver.com/web/login, and I get a proper Odoo login page. Close enough, but still not there, because the /web part is still visible.
So, how would it be possible to proxy in such a way, that when:
User loads http://odoo.myserver.com - gets http://127.0.0.1:8069/web
User loads http://odoo.myserver.com/login - gets http://127.0.0.1:8069/web/login
...?
<VirtualHost *:80>
ServerAdmin webmaster#localhost
ServerName odoo.myserver.com
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
<Location /login>
ProxyPass / http://127.0.0.1:8069/web/login
ProxyPassReverse / http://127.0.0.1:8069/web/login
</Location>
<Location />
ProxyPass / http://127.0.0.1:8069/web
ProxyPassReverse / http://127.0.0.1:8069/web
</Location>
</VirtualHost>
Try this config
Related
I have an application that makes a call to an external URL.
When I try to run it in localhost only some static HTML files which are in the localhost get loaded.
Any files located on the external URL doesn't load. It returns a 404 not found error.
I am using Apache sever, and Tomcat to run the application.
My Httpd.conf file has the following changes:
<VirtualHost *:80>
ProxyPreserveHost On
ProxyRequests On
ProxyVia On
ServerName localhost
ServerAlias *.localhost
ProxyPass /ab-ux-sass http://localhost:8080/ab-ux-sass
ProxyPassReverse /ab-ux-sass http://localhost:8080/ab-ux-sass
ProxyPass /ux-services https://boot.lender.com/ux-services
ProxyPassReverse /ux-services
https://boot.lender.com/ux-services
</VirtualHost>
what config changes needs to be made?
Made the following changes in the Httpd.conf file. It is working now.
<VirtualHost *:80>
ServerName dev.localhost
SSLProxyEngine on
ProxyRequests Off
<Proxy *>
Order allow,deny
Allow from All
</Proxy>
ProxyPass /ab-ux-sass http://localhost:8080/ab-ux-sass
ProxyPassReverse /ab-ux-sass http://localhost:8080/ab-ux-sass
ProxyPass /ux-services https://boot.lender.com/ux-services
ProxyPassReverse /ux-services
https://boot.lender.com/ux-services
</VirtualHost>
I've linked a subdomain to my Tomcat app, but I donĀ“t want to put the name of the folder to access. I've done this using Apache as a proxy.
<VirtualHost *:80>
ServerName domain.example.com.pe
ProxyRequests Off
ProxyPreserveHost On
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
ProxyPass /SSHR http://192.168.10.52:8081/SSHR
ProxyPassReverse /SSHR http://192.168.10.52:8081/SSHR
</VirtualHost>
I've tried with this lines:
ProxyPass / http://192.168.10.52:8081/SSHR/
ProxyPassReverse / http://192.168.10.52:8081/SSHR/
It works, but I've some problems with the Tomcat application. So, what I need is something to redirect from example.domain.com.pe to example.domain.com.pe/SSHR.
I am trying to setup Reverse Proxy using Apache Server 2.4.23 for two different domain. One domain is pointing to localhost site and other is pointing to other server web site. Here are my configuration
Listen 111.111.11.222:80
Listen 111.111.11.333:80
<VirtualHost 111.111.11.222:80>
ServerName myapp.com
ErrorLog "logs/app_error_log"
CustomLog "logs/app_access_log" common
ProxyRequests Off
ProxyPreserveHost On
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
ProxyPass / http://111.111.11.222:8090/
ProxyPassReverse / http://111.111.11.222:8090/
<Location />
Order allow,deny
Allow from all
</Location>
</VirtualHost>
<VirtualHost 111.111.11.333:80>
ServerName myauditor.com
ProxyRequests Off
# ProxyPreserveHost On
ErrorLog "logs/auditor_error_log"
CustomLog "logs/auditor_access_log" common
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
ProxyPass / http://www.mycompamy.com/
ProxyPassReverse / http://www.mycompany.com/
</VirtualHost>
In these settings, first "myapp.com" is working fine as needed. However when I try myauditor.com then instead of acting it as reverse proxy, it is redirecting to www.mycompany.com.
In myauditor.com setting, if I un-comment and use ProxyPreserveHost On then myauditor.com start giving me error
Invalid URL
The requested URL "http://%5bNo%20Host%5d/", is invalid.
Reference #9.2d3d6b68.1485193636.126886bd
I am new to Apache so I am not sure, when ProxyPreserveHost is working fine in first VirtualHost then why it causing issue in second VirtualHost.
I am using mod_proxy module to forward all requests for one of my domain to be served by Tomcat. However I want to forward only requests ending *.jsp or *.do or *.something to Tomcat and rest (e.g. *.html, *.php, *.png) to be served by Apache server. How to achieve that using mod_proxy?
Following is sample httpd.conf config that I am using currently:
<VirtualHost *:80>
DocumentRoot /usr/share/tomcat6/webapps/mywebapp
ServerName example.com
ServerAlias www.example.com
ProxyRequests Off
ProxyPreserveHost On
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
ProxyPass / ajp://localhost:8009/
ProxyPassReverse / ajp://localhost:8009/
</VirtualHost>
I know that you had found the answer but I write this answer for others that maybe need it:
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
#ProxyPass / ajp://localhost:8009/
ProxyPassMatch ^/(.*\.do)$ ajp://localhost:8009/$1
ProxyPassMatch ^/(.*\.jsp)$ ajp://localhost:8009/$1
My roommate and I each have a separate webserver we are trying to set up. We are trying to use mod_proxy so that his server will forward requests to my machine (we have two seperate machines behind one router) based on the server name. I've given the basics of what we have in our apache config currently but we are getting a 403 Forbidden error when trying to access the second domain (the first, www domain, works fine).
NameVirtualHost *:80
<VirtualHost *:80>
DocumentRoot /var/www
ServerName www.<domain1>.com
</VirtualHost>
<VirtualHost *:80>
ProxyPreserveHost On
ProxyPass / http://<IP addr of other box>:80
ProxyPassReverse / http://<IP addr of other box>:80
ServerName <dummydomain>.gotdns.com
</VirtualHost>
Your mods-enabled/proxy.conf might be blocking any proxy requests (it's deny all by default). It should include the following instead:
ProxyRequests Off
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
EDIT: Also make sure that the mod_proxy submodules are sym linked into mods-enabled (in this case, the http sub module which is mods-available/proxy_http.load)
Just put both routes:
<VirtualHost *:80>
DocumentRoot "/app/"
ProxyPreserveHost On
ProxyRequests Off
ServerName app.yourdomain.com
ProxyPass /app http://yourIP:yourPort/app/
ProxyPassReverse /app http://yourIP:yourPort/app/
ProxyPass / http://yourIP:yourPort/app/
ProxyPassReverse / http://yourIP:yourPort/app/
</VirtualHost>
<Location "/app/" >
ProxyPass "http://yourIP:yourPort/app/"
ProxyPassReverse "http://yourIP:yourPort/app/"
ProxyPassReverseCookiePath "/app/" "/app/"
ProxyHTMLEnable Off
ProxyHTMLExtended On
ProxyHTMLURLMap "/app/" "/app/"
Order allow,deny
Allow from all
</Location>
This worked form me