Created
March 29, 2018 17:40
-
-
Save KillerGoldFisch/53c7ea0ca31824b4328b0dfe48087966 to your computer and use it in GitHub Desktop.
Membrane service proxy HTTP to HTTPS rewriter
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <spring:beans xmlns="http://membrane-soa.org/proxies/1/" | |
| xmlns:spring="http://www.springframework.org/schema/beans" | |
| xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
| xsi:schemaLocation="http://www.springframework.org/schema/beans | |
| http://www.springframework.org/schema/beans/spring-beans-4.2.xsd | |
| http://membrane-soa.org/proxies/1/ http://membrane-soa.org/schemas/proxies-1.xsd"> | |
| <router> | |
| <serviceProxy name="HTTPS Rewriter" port="80" host="*"> | |
| <groovyTemplate><![CDATA[ | |
| try { | |
| def host = (exc.request.header =~ /Host: (.*)/)[0][1]; | |
| def target = "https://"+host + exc.requestURI; | |
| html { | |
| head { | |
| title('Redirect') | |
| html('<meta http-equiv="refresh" content="0; url=' + target + '" />') | |
| } | |
| body{ | |
| p('Redirecting to ' + target) | |
| } | |
| } | |
| } catch (Exception ex) { | |
| println exc.request; | |
| println ex; | |
| } | |
| ]]> | |
| </groovyTemplate> | |
| </serviceProxy> | |
| </router> | |
| </spring:beans> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment