[ https://issues.apache.org/jira/browse/SLING-1324?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12804958#action_12804958 ]
Felix Meschberger commented on SLING-1324: ------------------------------------------ Extended the RedirectResource in Rev. 903131 to provide the desired redirect status. > sling:redirect does not respect sling:status > -------------------------------------------- > > Key: SLING-1324 > URL: https://issues.apache.org/jira/browse/SLING-1324 > Project: Sling > Issue Type: Bug > Components: JCR, Servlets > Affects Versions: Servlets Get 2.0.8, JCR Resource 2.0.6 > Reporter: Andrew Khoury > Assignee: Felix Meschberger > Priority: Minor > > 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:ad...@localhost:8080/etc/map/http/redirect-test > curl -F "sling:resourceType=sling:redirect" -F "sling:target=/foo.html" -F > "sling:status=301" http://admin:ad...@localhost:8080/test > curl -X POST http://admin:ad...@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:ad...@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:ad...@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 -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.