Articles of 重写

Azure Iis站点非www到wwwredirect规则忽略CDN域请求

非www的redirect规则到www.sitedomain.com工作,但CDN域请求的豁免规则被忽略( add input =“{HTTP_HOST}”pattern =“cdnprefix.azureedge.net”negate =“true” )和CDN请求redirect到www.sitedomain.com。 规范redirect部分是否可以修改为忽略CDN域? <rule name="Redirect non-www to www.sitedomain.com" stopProcessing="true"> <match url="(.*)" /> <conditions logicalGrouping="MatchAll" trackAllCaptures="false"> <!– domain is not canonical –> <add input="{HTTP_HOST}" matchType="Pattern" ignoreCase="true" pattern="^sitedomain\.com$" /> <add input="{HTTP_HOST}" pattern="^www\.sitedomain\.com$" negate="true" /> <add input="{HTTP_HOST}" pattern="cdnprefix\.azureedge\.net" negate="true" /> </conditions> <action type="Redirect" url="https://www.sitedomain.com/{R:1}" redirectType="Permanent" /> </rule> 再加上有效的HTTP – > httpS topredirect规则(分解为简化CDN免除规则的解决scheme),看起来像这样: <rule […]

Nginx – 用文件名中的空格来提供静态html内容

我使用这个设置来提供静态html文件: server { root /var/www/static_html; index index.html index.htm; location / { try_files $uri $uri/index.html $uri.html =404; autoindex on; } } 现在,如果一个文件名包含空格"spam spam.html"则回应是“404 Not Found” 在access.log中: "GET /spam%20spam.html HTTP/1.1" 404 可以提供这些文件吗?

在nginx中重写/?

编辑:我也有我的洋葱这个问题。 https://tor.stackexchange.com/questions/15099/nginx-directory-disclosures 试图做一个简单的redirect,但我无法弄清楚。 我只是想请求包括最后/正斜杠。 所以/foo被redirect到/foo/ 。 这是我尝试过的一些事情。 rewrite ^/foo /foo/ permanent; location ~ /foo(.*)$ { rewrite ^ /foo/ permanent; } rewrite ^(/foo)(.*)$ http://website.com/foo/ permanent; rewrite ^/(foo.*) /foo/ permanent;

通过IIS反向代理与https的节点JS应用程序

你可以帮我通过IIS反向代理的HTTPS? 我在本地networking中设置我的nodejs应用程序为http://mayapp.domain.com:8080和https://myapp.domain.com:8443 。 它工作正常。 对于外部访问,我使用端口转发(8080-> 80,8443-> 443)的IIS反向代理(ARR和URL重写模块3.0)。 外部http现在工作正常,但https返回404(未find)

Nginx的正则expression式不工作

我试图使用这个正则expression式来获得每个主机不同的sitemap.xml,没有子域: rewrite "([a-zA-Z\d-]+).([a-zA-Z\d-]+\.([az]{2,3}))\/sitemap.xml" /sitemaps/$2.xml; 正如你可以在这里看到https://regex101.com/r/WVQQ27/1正则expression式工作和第二捕获组应该是没有子域的主机。 但由于某种原因,我一直得到404。任何想法? 技术背景是,我们针对不同的域名拥有不同的站点地图,但也根据同一应用程序提供的内容的语言来共享内容。

nginx从request_uri中提取并将其添加到redirct目标

我目前正在使用nginx将现有网站的新版本移植到新的服务器上,并且已经被告知URL需要指向新的PHP文件来处理如何从新的数据库中挑选date。 一个传入url的例子是: https://testsite.com/test-account-here-ABC-123456.html 这是由nginx抓到并redirect到 https://testsite.com/profiles.php 在那里文件将做它的位,并提取url,以获得其细节,并进行search。 我已经build立了一个redirect的前提下,$ request_uri在URL中find** – ABC- *,如下所示: if ($request_uri ~ ^/(.*)-ABC-) { return 302 $scheme://testsite.com/profile.php; } 成功去那个PHP文件,但我需要能够从URL(123456)中提取数字,所以我可以通过查询string在PHP文件中访问它们,我试图用户 return 302 $scheme://testsite.com/profile.php?url=$request_uri; 但是这会返回导致无限redirect循环和浏览器错误的完整url。 有无论如何,你可以提取一个$ request_uri的部分,然后重新使用redirect? 东西沿线 return 302 $scheme://testsite.com/profile.php?url=$variable1;

更改反向代理响应位置

我在IIS上configuration了一个反向代理,它执行一个URL重写(使用ARR 3.0和URL重写模块2.0)到一个托pipe在tomcat服务器上的网站。 使用configuration反向代理本身的IIS没有configurationSSL,而且我们当前依靠负载均衡层configuration了https,而configuration的IIS位于防火墙后面,大多数用户不能真正使用http访问网站,他们必须使用https访问。 到目前为止,一切都很好,除了当我试图从该网站做login尝试,内部它在login后触发redirect,请求URL是https:// xxx ,但是,响应位置变成http://和因此,防火墙被阻止,网站没有find,但最终的“解决scheme”应该是在响应位置将http更改为https。 但是,由于我对IISconfiguration的知识有限,我不知道应该在哪里寻找帮助或任何相关的文档。 谢谢 PlayKid

IIS重写和反向代理configuration两个公共URL

我正在尝试使用IIS反向代理和重写规则的组合来混淆第三方门户(我认为是用JBoss编写的)。 该门户在根和公共子部分有一个pipe理员login。 身份证“喜欢使用两个”公共“urlredirect/重写到公共方面的具体forms: some1.domain.edu→host1.xy.domain.edu:8080/form/public/previewform.do?formid=31&navigation=5&isPublicCategory=2&header=&ancestorL=0, some2.domain.edu→host1.xy.domain.edu:8080/form/public/previewform.do?formid=38&navigation=5&isPublicCategory=2&header=&ancestorL=0, 我是一个相对新手到IIS反向代理function和重写模块,所以帮助将非常感激。

将htaccess url重写规则转换成nginx

我怎样才能在这里转换我的htaccess规则 RewriteRule ^/?([^/]+)/([^/]+)/?$ page-1.php?a=$1&b=$2 [L,QSA] RewriteRule ^/?([^/]+)/([^/]+)/([^/]+)/?$ page-2.php?a=$1&b=$2&c=$3 [L,QSA] 纳入nginx规则? 我试过使用转换器,但我得到以下 winginx location / { rewrite ^/?([^/]+)/([^/]+)/?$ /page-1.php?a=$1&b=$2 break; rewrite ^/?([^/]+)/([^/]+)/([^/]+)/?$ /page-2.php?a=$1&b=$2&c=$3 break; } anilcetin rewrite ^/?([^/]+)/([^/]+)/?$ /page-1.php?a=$1&b=$2 last; rewrite ^/?([^/]+)/([^/]+)/([^/]+)/?$ /page-2.php?a=$1&b=$2&c=$3 last; 但是他们都没有工作,这里有什么问题? 在我的代码这里是一个页面 domain.com?page-1.php?a=a&b=b会变成domain.com/a/b domain.com?page-2.php?a=a&b=b&c=c进入domain.com/a/b/c

将子域映射到子目录和自定义标头以进行基本身份validation

我有一个客户端库,我需要支持这个硬编码子目录和自定义头authentication方法。 服务器已经使用子目录的其他东西,所以我想映射子域+子目录到不同的子目录。 服务器使用基本身份validation。 我已经正确地将子域重写到备用子目录,但是我在身份validation方面遇到了问题。 我目前在自定义标头中传递了base64编码的“user:pass”,并尝试使用proxy_set_header设置auth标头。 如何使用自定义标头中的值进行基本身份validation? server { server_name subdomain.example.com; listen 443; ssl on; ssl_certificate /etc/nginx/ssl/example.crt; ssl_certificate_key /etc/nginx/ssl/example.key; rewrite ^/hardcodesubdir/(.*)$ https://example.com/newsubdir/$1; proxy_set_header Authorization "Basic $http_x_custom_header"; }