0



I am change from Apache to NGINX to front-End My WSO2 environment. So Now I am stucked in store front-end config file.
At this point, I have my store.conf like this:

server {
    listen 443 ssl;
    server_name storedomain.com;
    proxy_set_header X-Forwarded-Port 443;
    error_log  /var/log/nginx/store.log ;
    access_log /var/log/nginx/access-store;
    #SSL CONFIG
    ...
    location /{
        proxy_set_header X-Forwarded-Host $host;
        proxy_set_header X-Forwarded-Server $host;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header Host $http_host;
        proxy_read_timeout 5m;
        proxy_send_timeout 5m;
        proxy_pass https://storenode:9443;
        proxy_redirect default;
        proxy_cookie_path /store/ /;
    }
}

My store site.json file have the follow configs for reverse proxy:

"reverseProxy" : {
    "enabled" : true,    // values true , false , "auto" - will look for  X-Forwarded-* headers
    "host" : "storedomain.com", // If reverse proxy do not have a domain name use IP
    "context":"",
    //"regContext":"" // Use only if different path is used for registry
  },

Now in ever request made to https://storedomain.com/ NGINX is appending '/publisher' and its drive me crazy.
I have other .conf files fors gateway, iskm, publisher nodes end this just happen in store nginx config. Why? how to fix it?

P.S The follow code it was an apache conf file that works fine....

<VirtualHost storedomain.com:443>

    SSLEngine on
.....

    CustomLog /var/log/httpd/store.log combined
    ErrorLog /var/log/httpd/store.error.log

    ServerName storedomain.com

    # disable forward proxy requests
    ProxyRequests off
    SSLProxyEngine On
    #SSLProxyVerify off
    SSLProxyCheckPeerCN off
    SSLProxyCheckPeerName off
    SSLProxyCheckPeerExpire off
    ProxyPreserveHost On

    UseCanonicalName On

    ProxyPass / https://stroenode:9443/store/
    ProxyPassReverse / https://stroenode:9443/store/
    ProxyPassReverseCookiePath "/store" "/"

    ProxyPass /registry https://stroenode:9443/registry/
    ProxyPassReverse /registry https://stroenode:9443/registry/

    ProxyPass /services https://stroenode:9443/services
    ProxyPassReverse /services https://stroenode:9443/services

    ProxyPass /apis https://stroenode:9763/api/am/store/v0.14/apis
    ProxyPassReverse /apis https://stroenode:9763/api/am/store/v0.14/apis

    ProxyPass /store https://stroenode:9763/store/
    ProxyPassReverse /store https://stroenode:9763/store/
</VirtualHost>
ChelloFera
  • 349
  • 1
  • 3
  • 16

1 Answers1

0

As exposed in hte Official documentation (https://docs.wso2.com/display/AM220/Directing+the+Root+Context+to+the+API+Store), This is the normal behavior of APIM. You can change this bahavior as follow:

1- Open the bundle /repository/components/plugins/org.wso2.am.styles_1.x.x.jar.
2- Open the component.xml file that is inside META-INF directory.
3- Change the element, which points to publisher by default, to store:

<context>
        <context-id>default-context</context-id>
        <context-name>store</context-name>
        <protocol>http</protocol>
        <description>API Publisher Default Context</description>
 </context>

4- Compress the JAR and put it back in the /repository/components/plugins directory.
5- Restart the server.

ChelloFera
  • 349
  • 1
  • 3
  • 16