Details
-
Bug
-
Status: Closed
-
Minor
-
Resolution: Fixed
-
Servlets Get 2.0.8, JCR Resource 2.0.6
-
None
Description
When you set a sling:status=301 for a sling:redirect it ignores this and uses a 302 instead:
1. Configure /etc/map configuration and a sling:redirect like this
curl -F "jcr:primaryType=sling:Mapping" -F "sling:redirect=/foo.html" -F "sling:status=301" -F "sling:match="[^/]+/redirect-test.html" http://admin:admin@localhost:8080/etc/map/http/redirect-test
curl -F "sling:resourceType=sling:redirect" -F "sling:target=/foo.html" -F "sling:status=301" http://admin:admin@localhost:8080/test
curl -X POST http://admin:admin@localhost:8080/foo
Go to the resource resolver page of /system/console to see the /etc/map mapping showing the 301
http://localhost:8080/system/console/jcrresolver
Mapping shown on jcrresolver page:
^http/[^/]+/redirect-test.html /foo.html external: 301
curl -v http://admin:admin@localhost:8080/redirect-test
- About to connect() to localhost port 8080 (#0)
- Trying ::1... connected
- Connected to localhost (::1) port 8080 (#0)
- Server auth using Basic with user 'admin'
> GET /test2 HTTP/1.1
> Authorization: Basic YWRtaW46YWRtaW4=
> User-Agent: curl/7.19.4 (universal-apple-darwin10.0) libcurl/7.19.4 OpenSSL/0.9.8k zlib/1.2.3
> Host: localhost:8080
> Accept: /
>
< HTTP/1.1 302 Found
< Location: http://localhost:8080/foo.html
< Content-Length: 0
< Server: Jetty(6.1.x)
< - Connection #0 to host localhost left intact
- Closing connection #0
curl -v http://admin:admin@localhost:8080/redirect-test.html
- About to connect() to localhost port 8080 (#0)
- Trying ::1... connected
- Connected to localhost (::1) port 8080 (#0)
- Server auth using Basic with user 'admin'
> GET /redirect-test.html HTTP/1.1
> Authorization: Basic YWRtaW46YWRtaW4=
> User-Agent: curl/7.19.4 (universal-apple-darwin10.0) libcurl/7.19.4 OpenSSL/0.9.8k zlib/1.2.3
> Host: localhost:8080
> Accept: /
>
< HTTP/1.1 302 Found
< Location: http://localhost:8080/foo.html
< Content-Length: 0
< Server: Jetty(6.1.x)
< - Connection #0 to host localhost left intact
- Closing connection #0