Question:
I have a question reg. wix-router module as I move my website to WIX. I previously had a maven2 repository under www dot domain dot org/maven2. Now I had to move this to a new server under maven.domain.org.
My issue now is that I cannot use normal WIX functions to redirect all request from “www dot domain dot org/maven2” to “maven dot domain dot org”.
I tried to setup a wix-router like this:
import {redirect} from 'wix-router';
export function maven2_Router(request) {
return redirect("https://maven.domain.org" + request.path, "301");
}
But it doesn’t redirect but just output some html code instead of a 301 redirect.
What are you trying to achieve:
I want to create 301 redirects for all files under www dot domain dot org/maven2 to maven dot domain dot org
Can you share the following?
- How you’re making the request
- What the HTML output you’re getting is
as it is maven I’m trying something like this:
wget https://www.dcm4che.org/maven2/dcm4che/dcm4che-net/2.0.26/dcm4che-net-2.0.26.jar
and I get the following response (just a snippet here):
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset='utf-8'>
<meta name="viewport" content="width=device-width, initial-scale=1" id="wixDesktopViewport" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="generator" content="Wix.com Website Builder"/>
<link rel="icon" sizes="192x192" href="https://static.parastorage.com/client/pfavico.ico" type="image/x-icon"/>
<link rel="shortcut icon" href="https://static.parastorage.com/client/pfavico.ico" type="image/x-icon"/>
<link rel="apple-touch-icon" href="https://static.parastorage.com/client/pfavico.ico" type="image/x-icon"/>
<!-- Safari Pinned Tab Icon -->
<!-- <link rel="mask-icon" href="https://static.parastorage.com/client/pfavico.ico"> -->
<!-- Original trials -->
<script async="" src="https://static.parastorage.com/services/wix-thunderbolt/dist/originTrials.41d7301a.bundle.min.js"></script>
<!-- Legacy Polyfills -->
<script nomodule="" src="https://static.parastorage.com/unpkg/core-js-bundle@3.2.1/minified.js"></script>
<script nomodule="" src="https://static.parastorage.com/unpkg/focus-within-polyfill@5.0.9/dist/focus-within-polyfill.js"></script>
.....
if (window.requestCloseWelcomeScreen) {
window.requestCloseWelcomeScreen()
}
if (!window.__browser_deprecation__) {
window.fedops.phaseStarted('partially_visible', {paramsOverrides: { pageId: firstPageId, isSuccessfulSSR: !clientSideRender }})
}
</script>
<script defer="" src="https://static.parastorage.com/services/tag-manager-client/1.827.0/siteTags.bundle.min.js"></script>
<script async="" id="wix-perf-measure" src="https://static.parastorage.com/services/wix-perf-measure/1.1095.0/wix-perf-measure.umd.min.js"></script>
<!--pageHtmlEmbeds.bodyEnd start-->
<script type="wix/htmlEmbeds" id="pageHtmlEmbeds.bodyEnd start"></script>
<script type="wix/htmlEmbeds" id="pageHtmlEmbeds.bodyEnd end"></script>
<!--pageHtmlEmbeds.bodyEnd end-->
<!-- warmup data start -->
<script type="application/json" id="wix-warmup-data">{}</script>
<!-- warmup data end -->
</body>
</html>
My router looks like this:
export function maven2_Router(request) {
return redirect(‘https://maven.dcm4che.org’);
}
Seems to be working fine for me with curl.
Downloads % curl https://www.dcm4che.org/maven2/dcm4che/dcm4che-net/2.0.26/dcm4che-net-2.0.26.jar --output test.jar
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 114k 100 114k 0 0 134k 0 --:--:-- --:--:-- --:--:-- 134k
Downloads % file test.jar
test.jar: Zip archive data, at least v1.0 to extract, compression method=store
Downloads % unzip test.jar
Archive: test.jar
creating: META-INF/
inflating: META-INF/MANIFEST.MF
creating: org/
because I reworked now everything without using routers.