lighttpd rewrite rule not working in some browsers - mod-rewrite

I'm Having some issues with Lighttpd rewrite options. I have a couple of different domains on the server, and the rewrite rules work just fine on those domins.
However, today I was going to add another domain, and the rewrite rules doesn't work for this domain (but still works good on all other domains).
I have tried many different configurations. But this is my "standard template", which I'm following on all domains. All domains have unique IP's.
$HTTP["host"] =~ "11.11.11.11|(^|\.)domain\.com" {
server.document-root = "/var/www/domain"
url.rewrite-once = (
"^/news$" => "?page=news"
)
}
When trying to access domain.com/news with Google Chrome it changes the URL instantly to domain.com//?page=news. But when I try the same with Internet Explorer or Firefox I'm just getting redirected to domain.com. When accessing ?page=news it works just fine.
Log output from Lighttpd: (says nothing about URI /news)
2014-08-12 20:23:25: (response.c.300) -- splitting Request-URI
2014-08-12 20:23:25: (response.c.301) Request-URI : //?page=news
2014-08-12 20:23:25: (response.c.302) URI-scheme : http
2014-08-12 20:23:25: (response.c.303) URI-authority: domain.com
2014-08-12 20:23:25: (response.c.304) URI-path : //
2014-08-12 20:23:25: (response.c.305) URI-query : page=news
2014-08-12 20:23:25: (response.c.349) -- sanatising URI
2014-08-12 20:23:25: (response.c.350) URI-path : /
Anyone!?!? :(

The issue was browser cache. It had nothing to do with the server configuration at all. Cleaning cookies + cache helped solving this issue.
Having the same issue? Open your browser in private browsing mode (browser will automatically leave any saved cache+cookies unused).

Related

Weblogic 12.2 + url rewriting = response blocked

I have to refresh an old webapp and i'm facing a problem i can't find...
Old situation :
webapp (Java6, wicket) on Weblogic 10.3, external access via URL rewrite by IIS
everything OK
New situation :
refreshed webapp on WL 12.2, IIS unchanged.
Results : Inside URLs : everything OK
Outside URLs : HTTP 200 OK, but all pages HTTP 302 (redirections) fails
browser receive 503 (unavailable) after a while.
I looked at the logs :
WL12 : process OK, response 302 found, location:inside URL
IIS : found code 400
I looked at [Oracle docs][1], i saw that they added CSRF protection, i believed it could be that, i disabled it, but nothing changed.
Any idea ?
Thanks in advance.
[1]: https://docs.oracle.com/middleware/12213/wls/WBAPP/weblogic_xml.htm#WBAPP-GUID-E3A9B2FC-E098-43B1-ACFF-4A457D6062DE search for "referer-validation"
Forget that.
The WL12 was installed on an "end of life" server running HP Unix.
I deployed the same app on WL12 on redhat, it worked as intended.

TYPO3 - HTTPS Migration

I'm running a website under TYPO3 6.2 and follow this tutorial in order to migrate my website on HTTPS. For now I got success with :
following typoscript configuration on the root page :
config.absRefPrefix = auto
config.baseURL >
following TSconfig on the root page :
TCAdefaults.pages.url_scheme = 2
.. and everything seem to work fine. But if I edit this parameter :
... website shuts down with infinite redirection loop (301 Moved Permanently). Why ? The result is the same (infinite loop) if I execute this query :
UPDATE pages SET url_scheme = 2
...and same for BE if I make this change :
$GLOBALS['TYPO3_CONF_VARS']['BE']['lockSSL'] = ‘2’;
You should not use the url_scheme field exactly because of issues like these. In fact this field was dropped with TYPO3v8. Any Page TSConfig related to url_scheme should be removed and you should run an SQL query to fix all existing pages.
Instead you should enforce HTTPS using a redirect in your .htaccess.
Infinite loops like these are usually caused by redirects performed both by TYPO3 and your webserver:
You request the site with HTTP.
TYPO3 redirects to HTTPS
Your webserver redirects to HTTP
Repeat 2. and 3.
For this reason you should also check your existing redirects, e.g. for enforcing www. in your domain.

Typo3 behind Proxy

I'm trying to get a Typo3 (6.2) instance running behind a (forwarding) proxy (squid). I have set
'HTTP' => array(
'adapter' => 'curl',
'proxy_host' => 'my.local.proxy.ip',
'proxy_port' => '8080',
)
as well as
'SYS' => array(
'curlProxyServer' => 'http://my.local.proxy.ip:8080',
'curlUse' => '1'
)
The proxy doesn't ask for credentials.
When I try to update the extension list, I get the error message
Update Extension List
Could not access remote resource http://repositories.typo3.org/mirrors.xml.gz.
If I try Get preconfigured distribution, it says
1342635425
Could not access remote resource http://repositories.typo3.org/mirrors.xml.gz.
According to the proxy log, the server doesn't even try to connect to the proxy.
I can easily download the file using wget on the command line.
Ok, I've investigated he issue a bit more and from what I can tell, the Typo3 doesn't even try to connect anywhere.
I used tcpdump and wireshark to analyze the network traffic. The site claims to have tried sending a http-Request to repositories.typo3.org so I'd expect to find either a proxy connection attempt or a DNS query followed by an attempt to connect to that IP. (Of course, the latter is known not to work.) However, none of this happens.
I've tried some slight changes in the variable curlProxyServer. The documentation clearly states
String: Proxyserver as http://proxy:port/. Deprecated since 4.6 - will be removed in TYPO3 CMS 7. See below for http options.
So I tried adding the trailing "/" and removing the "http://" - no change. I'm confident there's no problem whatsoever regarding the proxy as the proxy isn't even contacted and has been working perfectly fine for everything else for years.
The error message comes from \TYPO3\CMS\Extensionmanager\Utility\Repository\Helper::fetchFile(). This one uses \TYPO3\CMS\Core\Utility\GeneralUtility::getUrl() to get the actual file content.
According to your setting, it should use the first part of the function, because curlUse is set and the URL starts with http or https.
So what you would need to do now is to throw some debug lines in the code and check at what point the request goes wrong.
Look at the source code, three possibilities come to mind:
The curl proxy parameters does not support a scheme, thus it should be 'curlProxyServer' => 'my.local.proxy.ip:8080',.
Some redirect does not work.
Your proxy has problems with https, because the TYPO3 TER should be queried over https.

Allow URLs with Dashes on azure websites

I am trying to make an SEO friendly link for a downloads page
using codeigniter hosted on Azure Websites, now this is working:
www.example.com/downloads/viewfile/34
now when i generated this link :
www.example.com/downloads/viewfile/my-nice-file-name-34
the Url rewrite works great locally on a WAMP server, but when deployed to the remote (Azure Webites IIS ?) it gives the error:
The resource you are looking for has been removed, had its name changed, or is temporarily unavailable.
I believe that the cause is: dash symbols are not allowed on IIS but is there a way arround ?
After all, i found out that its not the dash symbols that are causing the problem, but the words in the url itself
like yesterday i had www.example.com/downloads/viewfile/example-file-34
to some reason, having your domain-name in the url segments makes that error apear, so i simply replaced "mydomain" into nothing before generating the Url segment
$fileName = str_replace('mydomain','',$fileName);
return url_title($fileName.$fileId);
Now the same link above is www.example.com/downloads/viewfile/file-34 and its working fine.
i also noticed that same behavior is experienced when using some words like : ajax, json.
I hope this would be helful to somone.
In your routes.php file
Find
$route['translate_uri_dashes'] = FALSE;
Replace with
$route['translate_uri_dashes'] = TRUE;
You may need to look also into
URI Routing Codeigniter 3
http://www.codeigniter.com/user_guide/general/routing.html
Codeigniter 2 URI Routing
http://www.codeigniter.com/userguide2/general/routing.html

Nginx will not stop rewriting

I am attempting to configure an owncloud server that rewrites all incoming requests and ships them back out at the exact same domain and request uri but change the scheme from http to https.
This is failed miserably. I tried:
redirect 301 https://$hostname/$request_uri
and
rewrite ^ https://$hostname/$request_uri
Anyway, after removing that just to make sure the basic nginx configuration would work it as it had prior to adding the ssl redirects/rewrites it will NOT stop changing the scheme to https.
Is there a cached list somewhere in nginx's configuration that keeps hold of redirect/rewrite protocols? I cleared my browser cache completely and it will not stop.
AH HA!
in config/config.php there was a line
'forcessl' => true,
Stupid line got switched on when it received a request at the 443 port.
Turned off and standard http owncloud works and neither apache/nginx are redirecting to ssl.
Phew.

Resources