Articles of 重写

当页面不存在时,如何在不重写URL的情况下透明地redirect用户?

我有一个nginx作为代理的节点web应用程序。 这是该网站的server块: server { listen 80; server_name subdomain.example.org; location / { # Offline handling error_page https://example.org/502 proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Host $http_host; proxy_set_header X-NginX-Proxy true; proxy_pass http://127.0.0.1:4567; proxy_redirect off; # Socket.io Support proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; } } 如果Web应用程序发生故障,那么error_page指令会将用户发送到站点外,但URL最终会更改。 是否有可能发送用户到该网站,但在浏览器中保持相同的url?

IIS 7.5反向代理URL使用gzip重新写入网站

如果我们拥有www.ourdomain.com,并想重写www.google.comurl,我们将如何处理gzip压缩说谷歌域名。 我试图做一个概念certificate,我相信这个问题是我们正在尝试重新使用gzip的网站,所以IIS无法读取内容? 我禁用了所有压缩。 我们需要某种先决条件吗? HTTP错误500.52 – URL重写模块错误。 当HTTP响应的内容被编码(“gzip”)时,不能应用出站重写规则。 <?xml version="1.0" encoding="UTF-8"?> <configuration> <system.webServer> <urlCompression doStaticCompression="false" doDynamicCompression="false" dynamicCompressionBeforeCache="false" /> <rewrite> <outboundRules> <rule name="ReverseProxyOutboundRule1" preCondition="ResponseIsHtml1"> <match filterByTags="A, Form, Img" pattern="https://google.com/(.*)" /> <action type="Rewrite" value="http{R:1}://ourdomain.com/{R:2}" /> </rule> </outboundRules> <rules> <rule name="ReverseProxyInboundRule1" stopProcessing="true"> <match url="(.*)" /> <action type="Rewrite" url="http://google.com/{R:1}" /> </rule> </rules> </rewrite> </system.webServer> </configuration>

nginx点子域到子文件夹

我希望http://blog.domain.com/指向http://www.domain.com/blog 只是一个通知, 不要redirect到该位置,而只是指向它。 另外/博客不是一个文件夹。 例如它可能是blog.php 所以当我导航到http://blog.domain.com时 ,网站显示的内容来自http://www.domain.com/blog 我到目前为止所尝试的是: server{ listen 80; server_name blog.domain.com; rewrite ^/blog(.*) http://blog.domain.com/$1 permanent; } 结果是nginx返回404找不到错误。

将URLredirect到Tomcat web应用程序

我有一个Tomcat服务器与两个webapps,app1和app2( app部分是真的一样)。 每个应用程序都有一个独立的用户组。 我希望这些组能够使用group1.domain.com/app和group2.domain.com/appurl访问各自的应用程序,这意味着这些数字应该隐藏在浏览器中显示的url中。 我想这需要一个机制,将返回正确的应用程序基于URL的group#部分。 我对URL重写有一个模糊的理解。 有没有办法做到这一点只有雄猫? 或者我需要Apache HTTP服务器? 如果可能的话,我宁愿不使用Apache,但如果有必要的话,就不会遇到问题。

Nginx重写URL而不是静态文件

我需要重写URL http://www.domain.com/blog/wp-content/uploads/this-is-a-static-file.jpg 至 http://www.domain.com/wp-content/uploads/this-is-a-static-file.jpg 我正在使用这个规则: location /blog/wp-content$ { rewrite ^/blog/wp-content/(.*)$ /wp-content$1 last; } 奇怪的是,只有直接在wp-content之后而没有静态文件的URL被正确地重写: http://www.domain.com/blog/wp-content/uploads/ => http://www.migayopruebas.com/wp-content/uploads/ 但是,它有多个子级别或涉及静态文件,它不起作用: http://www.domain.com/blog/wp-content/uploads/migayo-trangulacion-laton.jpg => doesn't change http://www.domain.com/blog/wp-content/migayo-trangulacion-laton.jpg =>不会改变 任何人都可以指出我正确的方式来做到这一点? 我已经阅读了Nginx的文档和几个例子,仍然无法使其工作。 非常感谢,问候。

ModRewrite将站点合并为一个

您好我有configuration重写有一些问题有相当复杂的要求 浏览(www。)A.com应该=> www.B.com 浏览(www。)A.com/ {anything} / blah / foo / yes should => {anything} .B.com / blah / foo / yes 我有根重写工作,但无法使两个规则同时工作。 RewriteEngine On RewriteCond %{HTTP_HOST} ^(www\.)?A\.com [NC] RewriteRule ^$ http://www.B.com [NC,R=301] Redirect /surveys/ http://surveys.B.com/ 这是我试图将子目录redirect到子域直接而不是使用正则expression式。

在lighttpd中重写位置响应头

我有一个lighttpd 1.4.35的实例监听httpsstream量,并将其反向代理到后端服务器。 也就是说, .———-. .———-. client —https–> | lighttpd | —http–> | back-end | <–https— | | <–http— | server | `———-' `———-' 当我通过https(通过https)对代理页面进行HTTP发布时,后端服务器正在使用http而不是https返回Location标头。 Location: http://lighttpd_url/some_page.htm 有没有办法lighttpd可以重写位置标题中的url? 我在lighttpd 1.5.x中看到,proxy-core有一个rewrite-response指令,我想这就是它的样子: proxy-core.rewrite-response = ( "Location" => ( "^http://xyz/(.*)" => "https://xyz/$1" ), ) 但是,我如何重写lighttpd 1.4.x中的Location标题?

IIS维护与客户端IP例外

我没有IIS服务器的经验,但我将不得不执行网站更新。 是否有一个简单的方法来把维护页面,将显示给所有的客户端,除了从预定义的IP地址连接? 通常我已经在apache / nginx下执行了类似的更新,并且使用重写规则很容易实现,但是我无法使用IIS进行更新… 任何人都可以给我一步一步的指导如何正确设置它? 这个规则应该怎么看?

多个服务器的Apache代理:比较两个解决scheme

我需要为多个服务器设置Apache代理,为一个服务器设置一个代理。 我可以用两种方法做到这一点: 设置一个虚拟主机和多个代理。 每台服务器都作为虚拟主机的子目录:aaa.bbb.ccc / test1和aaa.bbb.ccc / test2 <VirtualHost *:443> ServerName aaa.bbb.ccc RewriteEngine on RewriteRule ^/test1$ /test1/ [R] RewriteRule ^/test1(.*) http://localhost:8080$1 [P] RewriteRule ^/test2$ /test2/ [R] RewriteRule ^/test2(.*) http://localhost:8081$1 [P] <Location "/test1"> … </Location> <Location "/test2"> … </Location> …. </VirtualHost> 设置N个虚拟主机和N个代理服务于N个服务器。 每台服务器将由一台虚拟主机提供服务。 NameVirtualHost *:443 <VirtualHost *.443> ServerName aaa.bbb.ccc RewriteEngine on RewriteRule ^(.*) http://localhost:8080$1 [P] <Location […]

nginx + varnish,为ssl优化cachingurl

我有一个工作清漆caching为我的网站,与不希望的副作用,请求与http域名caching与一个特定的url,并要求与另一个urlhttps。 这样我最终在caching中的双重对象,我想问一些如何优化这种行为的最佳做法。 详细我有nginx内的两个虚拟主机相同的域侦听端口80和443每个。 请求被代理传递给清漆: proxy_pass http://varnish:8101/VirtualHostBase/http/example.com:80/path/VirtualHostRoot/; 和 proxy_pass http://varnish:8101/VirtualHostBase/https/example.com:443/path/VirtualHostRoot/; 在varnish.vcl我检查请求的主机,并设置右后端,因为有多个。 if (req.http.host == "example.com") { set req.backend = backend_0; } 后端是一个Zope / Plone服务器。 页面caching正确varnish,但我有/VirtualHostBase/http/example.com:80/path/VirtualHostRoot/logo.png和/VirtualHostBase/https/example.com:443/path/VirtualHostRoot/一个条目在我的varnishlog(RxURL)中的logo.png。 Plone清除条目时,只清除ssl版本,因为每个login用户都必须使用https。 http条目保持到年龄无效。 是否有可能通过重写URL来将http和https请求合并成一个清漆对象? 为了节省空间和做一个成功的清除。 也许有人可以给我一个提示如何解决这个问题!