比较来自世界各地的卖家的域名和 IT 服务价格

Nginx 覆盖包含空白的参数

它应该很容易,但我试图在某个地方获得正确的正则表达式语法来重写。 简而言之,我需要找到一个带有空格的查询的特定行,然后将相同的参数传送到内部Web服务器。 这里缺少什么?

这个地方是:

     location = /SubDirectory/ {
if ($args !~* "Report Files"){ #Contains Spaces
set $report "LongString_guest.jsp?reportName=Report with several spaces&reportPath=/Share/Reports/REPORT&appSwitcherDisabled=true";
rewrite ^(.*)$ $report break;
}
proxy_pass [url=https://srvweb;]https://srvweb;[/url] #upstream loadbalanced servers

我们有一个页面 SAS 9.4 VisualAnalyticsViewer 在另一个主持人上,我想公开想象 443. 内部服务器 SAS 推出 Apache Tomcat 并只倾听 8343. 我不想改变每个运营商 proxy_pass 在领域 SAS 或仅自定义其端口,以便通过端口提供一页 443, 如果可能的话。 目前,我们的Web服务器使用引用 IFrames 在内部服务器上更多 8343, 由于远程防火墙的限制,这是哪种工作,但限制了对整体用户访问的访问。 我想发帖 Nginx 在服务器之前 Tomcat, 所以他听了 443. 我的问题与重写运算符中的空格的处理有关。 任何人都可以向我展示正确的语法或如何实现这一目标的正则表达式吗?

请注意; 旁路 Nginx 并将带有空格插入完整的内部URL,以确保本地浏览器真正有效。

应用方案:

External Client Request:

[url=https://apppub.domain.com/appVisualAnalyticsViewer]https://apppub.domain.com/appVisualAnalyticsViewer[/url] Or,

[url=https://apppub.domain.com/appVisualAnalyticsViewer/VisualAnalyticsViewer_guest.jsp?reportName=Report]https://apppub.domain.com/appV ... eport[/url] with Spaces&reportPath=/Some Data Path with Spaces/SubFolder/REPORT&appSwitcherDisabled=true


代理服务器。 Nginx 检查查询字符串 URI, 然后覆盖或将其添加到内部服务器 SAS 通过港口 8343.

Nginx Reverse Proxy:

[url=https://appint.domain.com:8343/appVisualAnalyticsViewer/VisualAnalyticsViewer_guest.jsp?reportName=Report]https://appint.domain.com:8343 ... eport[/url] with Spaces&reportPath=/Some Data Path with Spaces/REPORT&appSwitcherDisabled=true


客户答案:

https://apppub.domain.com/appV ... ewer/
(从远程客户端浏览器URL删除查询字符串)

以下是完整配置。 apppub.conf (只在这个网站上), response.conf 和 proxy.conf, 由同一代理服务器上的多个站点使用。


Nginx Config:

upstream appint {
least_conn;
server appint.domain.com:8343;
}

server {

listen 80;
server_name apppub.domain.com;

access_log off;
autoindex off;

location / {
# Rate limit first 6 requests and burst next 4. Reject everything else
limit_req zone=one burst=10 delay=6;
return 301 https://$server_name$request_uri;
}

}

server {

listen 443 ssl;

server_name apppub.domain.com;

# Site Specific Logging Metrics
access_log /var/log/nginx/apppub.access.log main_ext;
error_log /var/log/nginx/apppub.error.log warn;

autoindex off;

# Load SSL cert and session security
include /etc/nginx/conf.add/domain-ssl.conf;

# Add Security and Caching Headers to responses
add_header X-Frame-Options SAMEORIGIN;
add_header X-Content-Type-Options nosniff;
add_header X-XSS-Protection "1; mode=block";
add_header Cache-Control no-cache;
add_header Vary Accept-Encoding;
expires 5m;

# Load client buffers and timeout response
include /etc/nginx/conf.add/response.conf; (See Below)

# Load Gzip mime type compression
include /etc/nginx/conf.add/gzip.conf;


# /appVisualAnalyticsViewer/

location ~ ^/appVisualAnalyticsViewer {

if ($args !~* "Report Name with Spaces"){
set $report "VisualAnalyticsViewer_guest.jsp?reportName=Report with Spaces&reportPath=/Some Data Path with Spaces/REPORT&appSwitcherDisabled=true";
rewrite ^(.*)$ $report break;
**(What's the correct syntax for a rewrite?)**
}

include /etc/nginx/conf.add/proxy.conf; (See Below)
proxy_pass [url=https://appint;]https://appint;[/url]

}

Response Config:
Form POST submissions

client_body_buffer_size 1024K;
Form POST maxiumum size

client_max_body_size 16m;
Max client header size

client_header_buffer_size 2k;
Max time to receive client headers/body from buffer

client_body_timeout 5s; client_header_timeout 5s;
Max time to keep a connection open to clients

keepalive_timeout 5s;
Max time for the client accept/receive a response

send_timeout 5s;
Skip buffering for static files

sendfile on;
Optimize sendfile packets

tcp_nopush on; }

    Proxy Config:

Proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr; proxy_set_header
X-Forwarded-Host $host; proxy_set_header X-Forwarded-Port $server_port;

proxy_set_header Connection ""; # Enable keepalives proxy_set_header
Accept-
Encoding ""; # Optimize encoding proxy_set_header X-Forwarded-Host
$host:$server_port; proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

proxy_buffers 32 4m; proxy_busy_buffers_size 25m; proxy_buffer_size 512k;
proxy_headers_hash_max_size 512; proxy_headers_hash_bucket_size 128;
proxy_ignore_headers "Cache-Control" "Expires"; proxy_max_temp_file_size 0; proxy_next_upstream error timeout invalid_header http_500;
proxy_connect_timeout 90; proxy_read_timeout 90; proxy_send_timeout 90;
proxy_intercept_errors off;
已邀请:

要回复问题请先登录注册