Hello,

Thank you very much for your answer.

After struggling with this for several days, I finally found a solution.

I could not manage to execute the GeoServer inside a virtual machine, using an Apache alias redirected to the shared port like this:


ProxyPass /myAlias http://localhost:8085 <http://localhost:8085/>
ProxyPassReverse /myAlias http://localhost:8085 <http://localhost:8085/>

With this configuration the problem is is you need to use the alias to execute GeoServer https://myDomain/myAlias/geoserver, and Geoserver do not understand myAlias. The solution I found is to remove that alias by using a new domain for the same server (myAlias.MyDomain). To use it you have to set a new Apache virtual host like this.

/etc/apache2/sites-available/myAlias.conf

<IfModule mod_ssl.c>

<VirtualHost *:443>

ServerName myAlias.myDomain.com

ServerAdmin admin@admin

Header set Access-Control-Allow-Origin "*"

...

<Proxy *>

Order allow,deny

Allow from all

</Proxy>

<Location />

ProxyPass http://localhost:2081/

ProxyPassReverse http://localhost:2081/

</Location>

</VirtualHost>

</IfModule>


Remember to activate the site with a2ensite myAlias

The previous will send all the requests to https://myAlias.myDomain <https://myAlias.myDomain/> to the port 2081 of the host, which is redirected inside the virtual machine to the port 80

And inside the vagrant virtual machine, the Apache configuration I have is:

/etc/apache2/sites-available/000-default.conf

<VirtualHost *:80>

ServerName localhost

ServerAdmin admin@admin

...

ProxyPreserveHost On

ProxyPass /geoserver http://127.0.0.1:8080/geoserver

ProxyPassReverse /geoserver http://127.0.0.1:8080/geoserver

ProxyPass /geonetwork http://127.0.0.1:8080/geonetwork

ProxyPassReverse /geonetwork http://127.0.0.1:8080/geonetwork

ProxyPass /mapstore http://127.0.0.1:8080/mapstore

ProxyPassReverse /mapstore http://127.0.0.1:8080/mapstore

</VirtualHost>


All these configuration allow you to execute all the servlets installed in Tomcat without alias:

https://myAlias.myDomain/geoserver

https://myAlias.myDomain/geo <https://myAlias.myDomain/geoserver>network

https://myAlias.myDomain/mapstore



El 7/10/19 a las 12:14, Adam Borczyk escribió:
Hi, not sure but your issue sound similar to mine:
http://osgeo-org.1560.x6.nabble.com/Absolute-URL-paths-in-clustered-Geoserver-s-settings-td5407888.html

**Adam Borczyk**

*

*---------------------------------*

        

GIS Support Sp. z o.o.

Konrada Wallenroda 2f, Lublin 20-607 <https://maps.google.com/?q=Konrada+Wallenroda+2f,+Lublin+20-607>

tel. +48 81 451 14 90, NIP: 9462641761

*


On Fri, 4 Oct 2019 at 17:01, J. Gaspar Mora Navarro <[email protected] <mailto:[email protected]>> wrote:

    Hello,

    I can not access to GeoServer inside a virtual machine using a proxy.

    I have a Vagrant virtual machine. GeoServer is running inside the
    VM and it is accessible from the host through the port 8085, so
    http://localhost:8085/geoserver works perfect.

    In the Vagrantfile I have this line to set the forwarded port

        config.vm.network "forwarded_port", guest: 8080, host: 8085

    In the host I have also Apache2 installed, and I have a proxy
    configuration to access to the GeoServer inside the VM. The
    configuration is the following:

        <Proxy *>
          Order allow,deny
          Allow from all
        </Proxy>

        ProxyPreserveHost On

        ProxyPass /geonodegs http://localhost:8085
        ProxyPassReverse /geonodegs http://localhost:8085

    I know the proxy is working because typing
    http://localhost/geonodegs shows the Tomcat it works page.

    The problem is when I try to access to GeoServer using the proxy
    http://localhost/geonodegs/geoserver does not work. Geoserver
    redirects the request to http://localhost/geoserver/index.html,
    which do not exists. The proper url is
    http://localhost/geonodegs/geoserver/index.

    I have already set the setting 'settings/global/url base proxy' to
    http://localhost/geonodegs/geoserver, even I have edited the file
    /var/lib/tomcat8/webapps/geoserver/WEB-INF/web.xml and set the
    following.

        <context-param>
          <param-name>PROXY_BASE_URL</param-name>
    <param-value>http://localhost/geonodegs/geoserver</param-value>
        </context-param>

    I also restarted the tomcat service in the VM, but It does not wok.

    I need to use the Apache proxy because I must not open to internet
    the port 8085 in the real server.

    Thank you very much for your time.

    ---

    Software details:

        - Vagrant VM: Uuntu Server 18.04

        - Host: Ubuntu Desktop 16.04

        - Tomcat 8

        - Geoserver 2.14-snapshot

        - Vagrant 2.2.4

        - VirtualBox 5.1.38


    _______________________________________________
    Geoserver-users mailing list

    Please make sure you read the following two resources before
    posting to this list:
    - Earning your support instead of buying it, but Ian Turton:
    http://www.ianturton.com/talks/foss4g.html#/
    - The GeoServer user list posting guidelines:
    http://geoserver.org/comm/userlist-guidelines.html

    If you want to request a feature or an improvement, also see this:
    
https://github.com/geoserver/geoserver/wiki/Successfully-requesting-and-integrating-new-features-and-improvements-in-GeoServer


    [email protected]
    <mailto:[email protected]>
    https://lists.sourceforge.net/lists/listinfo/geoserver-users


_______________________________________________
Geoserver-users mailing list

Please make sure you read the following two resources before posting to this 
list:
- Earning your support instead of buying it, but Ian Turton: 
http://www.ianturton.com/talks/foss4g.html#/
- The GeoServer user list posting guidelines: 
http://geoserver.org/comm/userlist-guidelines.html

If you want to request a feature or an improvement, also see this: 
https://github.com/geoserver/geoserver/wiki/Successfully-requesting-and-integrating-new-features-and-improvements-in-GeoServer


[email protected]
https://lists.sourceforge.net/lists/listinfo/geoserver-users

Reply via email to