Articles of redirect

在Nginx中,将特定的子域映射到端口,redirect所有其他域

我试图完成三件事情: 按子域将stream量映射到不同端口上的多个应用程序之一。 如果子域没有被识别,redirect到www。 要求在所有子域上使用HTTPS。 我的nginxconfiguration到目前为止是: map $subdomain $subdomain_port { default 8000; www 8000; subdomain1 8001; subdomain2 8002; subdomain3 8003; } server { listen 80; listen [::]:80; server_name _; return 301 https://$host$request_uri; } server { listen 443 ssl; server_name ~^(?P<subdomain>.+?)\.mydomain\.com$; ssl_certificate <cert>; ssl_certificate_key <key>; location / { # … various proxy headers, then … proxy_pass http://127.0.0.1:$subdomain_port; […]

htaccess语言特定域的redirect/重写规则

我有基于grav-site.pl CMS的多语言站点和两个域: grav-site.pl和grav-site.com 我想redirect: grav-site.pl/en – > grav-site.com grav-site.com/pl – > grav-site.pl 在grav的基础上,我发现解决scheme应该工作,所以我把这个添加到我的.htaccess ## Begin – Multilanguage Setup RewriteRule ^en/?$ "http://grav-site.com" [R=301,L] RewriteRule ^pl/?$ "http://grav-site.pl" [R=301,L] # handle sub pages, exclude admin path RewriteCond %{REQUEST_URI} !(admin) [NC] RewriteRule ^en/(.*)$ "http://grav-site.com/$1" [R=301,L] RewriteCond %{REQUEST_URI} !(admin) [NC] RewriteRule ^pl/(.*)$ "http://grav-site.pl/$1" [R=301,L] # End – Multilanguage Setup 但是当我去http://grav-site.com/pl […]

如何设置URL重写到Heroku实例?

我更像是一个工程师,而不是一个开发人员,所以请原谅,如果这是非常基本的。 我的情况:我在example.edunetworking上有一个服务器,所以我不控制example.edu的主DNS接口。 所以我不相信我可以使用DNSSimple或者Zerigo。 但是我在服务器上有root,它有以下两个主机名: foo.example.edu bar.example.edu 我的目标是设置Apache执行以下操作。 首先,当一个访客inputfoo.example.edu时,他们应该看到一个静态的网页: http://foo.example.edu – >提供一个静态的网页 然后,如果访问者inputbar.example.edu,则应该执行URL重写,他们应该查看Heroku上托pipe的站点的HTTPS版本,如下所示: http://bar.example.edu – > https://bar-example-edu.herokuapp.com https://bar.example.edu – > https://bar-example-edu.herokuapp.com https://bar.example.edu/some/url – > https://bar-example-edu.herokuapp.com/some/url 特别是,这应该是一个URL重写,所以在浏览器的地址栏中,访问者将看到https://bar.example.edu/some/url而不是https://bar-example-edu.herokuapp.com/some/url 。 我如何去做这件事? 我想我应该使用Apache mod_rewrite,并编辑httpd.conf。 我刚开始看教程,但主要棘手的部分是,我没有完全控制域,并要确保我设置正确。

在SSL终止负载均衡器后面,如何设置nginxredirect到某个主机的https

您好,我有一个在ELB(负载平衡器)后面的EC2中的web服务器(运行nginx),终止SSL连接。 如果有一个请求www.domain.com它将http到ELB并传递到Nginx服务器上的http 如果有一个请求secure.domain.com它应该去https到ELB并传递到http到nginx服务器。 如果请求来自http://secure.domain.com我希望nginx做一个301redirect到https://secure.domain.com 。 我可以通过使用由ELB注入的http_X_Forwarded_Proto头来完成这个任务。 所以像 server { listen 80; server_name secure.domain.com ; if ($http_X_Forwarded_Proto = http) { return 301 https://secure.domain.com$request_uri; } …. } 问题是,“if()”似乎在服务器块上运行,因此,对于http://www.domain.com/foo (在另一个服务器块中)的请求被if()和301到https://secure.domain.com/foo 。 我怎样才能configurationnginx只是redirectsecure.domains.com到https而不影响我所有的其他虚拟主机? 谢谢

如何在tomcatredirect时将http更改为https

我正在使用弹性beanstalk单一实例。 所以有Apacheconfiguration和tomcat是在http端口8080监听。Apacheconfiguration上使用SSL HTTPS 443。 问题是,tomcat使用httpredirect。 但是我不能设置Apache来将http更改为https。 因此,混合内容错误会导致应用程序无法正常工作。 我到目前为止尝试了以下设置:在虚拟主机*:80我把 <IFModule mod_rewrite.c> RewriteEngine On RewriteCond %{HTTPS} off RewriteRule (.*) https://%{SERVER_NAME}/%$1 [R, L] </IFModule> 我也试过 RedirectMatch ^(/.*)$ https://thepennantrace.com/$1 两者都没有工作。 我想知道设置它的正确方法是什么? (应用程序正在运行Facebook,如果直接访问它不会显示任何错误)

我如何redirect我的服务器2012 R2传入域请求?

我有两个虚拟机在我的服务器上使用端口80.我如何redirectsub1.home.home机1和sub2.home.home机2 我认为我的路由器不是capatable的,所以端口80需要在服务器上以某种方式处理。 感谢提示和帮助。

如何将Apacheredirect到GlassFish服务器上的不同端口?

我有一个GlassFish实例在不同的端口上运行不同的服务。 Apache Web服务器位于GlassFish之前,我想在Apache上设置虚拟主机以redirect到GlassFish服务器上的某些端口。 我已经添加了Tomcat AJP作为jvm选项来监听端口8009,并在lib /下放置必要的.jars。 如何将GlassFishconfiguration为从8009端口redirect到同一实例上的给定端口(服务)?

将漫游configuration文件移到DFS

我正在使用GPO将appdata,我的文档和桌面文件夹redirect到服务器,这取决于他们通常使用的设备。 这为在多个位置之间弹跳的用户带来了问题。 Firefoxconfiguration文件存储在appdata,所以它需要永远到另一个设施获取Firefoxconfiguration文件,以便它可以启动。 在等待Firefox加载两到三分钟后,它运行得非常慢,几乎无法使用 我想用DFS补救这一点,但我不想有一个地狱般的过渡期。 现在,facility1的GPO被设置为将文件夹redirect到//server1/Documents ,而facility2的GPO被设置为将文件夹redirect到//server2/Documents 。 我知道我需要将这些设置更改为我创build的DFS名称空间。 我需要添加//server1/Documents和//server2/Documents到DFS命名空间//DFSDocuments/并更改GPOredirect设置以将appdataredirect到//DFSDocuments/UserName 。 把它写下来看起来很容易, 这就是我所要做的吗? 将GPO设置直接指向DFS名称空间中的用户名文件夹,而不必移动任何东西? 用户会看到任何打嗝? 或者它会神奇地复制? 我会很感激任何经过这个(非dfs文件夹redirect到dfs文件夹redirect)过渡的任何反馈和技巧。

redirect到公用事业服务器的方法

我有一种情况,我需要促进200M的file upload到与主网站服务器分离的公用事业服务器。 这是我的configuration: Authenticated Client on Public Internet /\ \ | \_____ 200M | \_____ | \_____ VV Authenticating <——-> Utility Server Web Site (EC2, Windows, Apache, Python, Django) Server (EC2 LAMP) 我目前的解决scheme仅仅是让我的Web服务器通过实用程序服务器的EC2 URL,并允许客户端直接与实用程序服务器通信。 这有两个缺陷 – 它暴露未经身份validation的实用程序服务器的URL,它需要客户端上的跨域技巧来将POST上载路由到实用程序服务器。 问题是什么是从客户端隐藏实用程序服务器的最佳方式,而不通过Web服务器推送file upload数据? 这些是我想要尝试的想法: DNS将实用程序服务器与子域别名。 这可能会修复我的跨域脚本问题,但我不确定它是否有助于保护公用事业服务器。 也许我可以从实用程序服务器检查Web服务器的身份validationCookie? 在网站的Apacheconfiguration中重写规则。 我不清楚这是如何影响POST的数据实际上被路由的。 在网站的Apacheconfiguration中redirect。 我不确定是否可以使用redirect来隐藏用户的实用程序服务器URL。 从网站的控制器代码redirect。 与#3相同的问题,但我认为这可能比#3更好,因为它会通过PHP身份validation层传递请求。 更好的东西?? 笔记: 实用程序服务器的不寻常configuration是需要执行的实用程序的可用软件的交集的function。 实用程序服务器不是严重恶作剧的高价值目标。 只要把前门锁上就足够了,但是我想避免把钥匙留在垫子下面。

不同的Nginxredirect基于上游代理响应

我有一个上游服务器处理我们的网站login。 在成功login时,我想将用户redirect到网站的安全部分。 在login失败时,我想将用户redirect到login表单。 上游服务器在成功login时返回200 OK ,在失败login时返回401 Unauthorized 。 这是我的configuration的相关部分: { error_page 401 = @error401 location @error401 { return 302 /login.html # this page holds the login form } location = /login { # this is the POST target of the login form proxy_pass http://localhost:8080; proxy_intercept_errors on; return 302 /secure/; # without this line, failures work. […]