为什么NGINX将'/ publisher'资源附加到我的请求中

问题描述 投票:0回答:1

我从Apache变为NGINX,再到前端My WSO2环境。所以现在我被困在商店前端配置文件中。在这一点上,我的store.conf是这样的:

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/ /;
    }
}

我的[[store site.json文件具有反向代理的以下配置:

"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 },
现在对https://storedomain.com/的任何请求都在NGINX的后面附加'/ publisher',这让我发疯。我还有其他.conf文件用于fors网关,iskm,发布者节点,这恰好发生在商店nginx配置中。为什么?如何解决?

P.S以下代码是一个apache conf文件,可以正常工作。...

<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>

apache nginx reverse-proxy wso2-am api-manager
1个回答
0
投票
如官方文档(https://docs.wso2.com/display/AM220/Directing+the+Root+Context+to+the+API+Store中所述,这是APIM的正常行为。您可以按以下方式更改此行为:

1-打开捆绑包/repository/components/plugins/org.wso2.am.styles_1.x.x.jar。2-打开META-INF目录内的component.xml文件。3-更改默认情况下指向发布者的元素来存储:

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

4-压缩JAR,然后将其放回/ repository / components / plugins目录。5-重新启动服务器。
© www.soinside.com 2019 - 2024. All rights reserved.