Unexpectedly redirecting to root address when request URL has special character in it - redirect

I'm facing the issue after upgrading server to RHEL 8.
Here is a php script I wrote to fetch the param:
<?php
if (isset($_GET)) {
echo $_GET['data'];
}
Now:
When I request to the server like: https://example.com?data=test
It prints 'test' perfectly
But, when I request to the server like: https://example.com?data="<title>test</title>"
It redirects to https://example.com and print nothing
Can anyone suggest a solution?

Related

Lumen: NotFoundHttpException in RoutesRequests.php line 229, Dispatcher NOT_FOUND

I tried a vue-lumen-tutorial with laravel-passport. All works fine for me except the LoginController (login by user and password).
I think its not a problem of the tutorial code, its more a server or laravel/lumen configuration problem. But i am not sure.
The code runs remote on a linux machine (18.04), apache server with Lumen (5.8.12) (Laravel Components 5.8.*) and with Passport.
The api endpoints are available but the /login endpoint gives a 404 Not found.
I found here some questions/answers concerning the index.php of lumen or .htaccess file. Just installed Lumen and got NotFoundHttpException . But it doesn't help me.
I am testing with Postman:
GET to https://domain/api/companies/ works fine,
POST to https://domain/api/oauth/token works fine, but
POST to https://domain/api/login gives a 404 Not found.
The route /login is ok.
...
return app()->version(); only for testing gives a request but i need the $tokenRequest:
...
return app()->dispatch($tokenRequest); => 404 Not found
...
error message:
(1/1) NotFoundHttpException
in RoutesRequests.php line 229
...
protected function handleDispatcherResponse($routeInfo)
{
switch ($routeInfo[0]) {
case Dispatcher::NOT_FOUND:
throw new NotFoundHttpException; <== 229
case Dispatcher::METHOD_NOT_ALLOWED:
throw new MethodNotAllowedHttpException($routeInfo[1]);
case Dispatcher::FOUND:
return $this->handleFoundRoute($routeInfo);
}
}
...
Maybe a proxy issue between /oauth/token and /login? What can i do?
LoginController here in row 45: https://github.com/aibim/vue-lumen-tutorial/blob/master/app/Http/Controllers/LoginController.php
I found the error. The APP_URL path .env was wrong. I
wrong: APP_URL=https://domain.de/public/
right: APP_URL=https://domain.de/

IO::Socket::SSL fails with IIS 8.5

Following script runs successfully when run with Perl CLI ( Windows). But when run through IIS 8.5, it fails.
use IO::Socket::SSL;
print <<EOP;
Content-type: text/html
<html><body>
<h1>Hello world</h1>
EOP
print "</body></html>\n";
Error message is
502 - Web server received an invalid response while acting as a
gateway or proxy server.
When "use IO::Socket::SSL" line is deleted, it is successfully executed.
With "use IO::Socket", it is too successfully executed.
Is there something wrong with my IIS / CGI configuration?
Thank you for your help.
I added directory containing libcrypto-1_1-x64__.dll file into system PATH and rebooted the machine. It solved my issue.

Unable to connect to JIRA over HTTPS server using the Perl JIRA::Client::Automated

I do not use a proxy.
Here is my code:
use JIRA::Client::Automated;
my $jira = JIRA::Client::Automated->new(https://myserver.com, "user", "password");
And the error response is:
Unable to GET /jira/rest/api/latest/issue/DCS-51191: 500 Can't connect
to myserver.com:443 Can't connect to myserver.com:443
Bad file descriptor at
C:/Users/Fred/applis_portables/Strawberry_Perl/perl/vendor/lib/LWP/Protocol/http.pm
line 47.
at createPage2.pl line 16.
Thank you for your help.
It seems that there is a self signed certificate on JIRA server. To bypass, I added following code:
my $jira_ua = $jira->ua();
$jira_ua->ssl_opts( verify_hostname => 0 );
The error doesn't look like a JIRA::Client::Automated error. It's generated by LWP::UserAgent and usually means exactly what is shown.
Do you have a self signed certificate on your server?
Did you try to open that URL in in your browser? https://myserver.com:443 (exactly as you provide it to the module).
Try using curl from your webserver:
curl -vvv https://myserver.com/jira/rest/api/latest/issue/DCS-51191
Maybe it's just a missing www. prefix in your server URL?

Encoding URL issue

I use XAMPP v3.2.1 and routing is fine for all URLs except when there is م in the URL. (م is a Persian character).
For e.g. the routhing of this URL is 404 Not Found:
localhost/FolderName/ClassName/MethodName/arg1/سلام%20بر
// if I remove this ^ character, everything will be fine
Output of that URL:
Not Found
The requested URL /myweb/islamic_sources/quran/843/سلام بر was not found on this server.
Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.
Apache/2.4.12 (Win32) OpenSSL/1.0.1l PHP/5.6.8 Server at localhost Port 80
How can I fix it?
what happens if you pipe the value through str_replace like so
$oldurl = '...._persian_character_ ....';
$newurl = str_replace('_persian_character_', '', $oldurl);

Express Checkout Digital Goods : Proxy Error on sandbox.paypal.com/incontext

I have a Flash website. When I want to use Paypal Express Checkout with Digital Goods, I call this javascript code :
dg = new PAYPAL.apps.DGFlow();
dg.startFlow("http://mydomain.com/setup.php");
setup.php calls SetExpressCheckoutPayment function and redirect to https://www.sandbox.paypal.com/incontext?token=...&useraction=commit
With Firebug I can see this address returns a 302, and redirects to https://www.sandbox.paypal.com/webapps/checkout/webflow/sparta/expresscheckoutvalidatedataflow?exp_type=&cookiesBlocked=&token=...&useraction=commit
This adress returns also a 302 and redirects to https://www.sandbox.paypal.com/webapps/checkout/webflow/sparta/expresscheckoutvalidatedataflow?execution=e1s1
Here it hangs for several minutes and ends with this error message :
Proxy Error
The proxy server could not handle the request GET /webapps/checkout/webflow/sparta/expresscheckoutvalidatedataflow.
Reason: Error during SSL Handshake with remote server
I started to get this error sometimes last week, and I have it every time today.
It happens on my MAMP environment and on my website.
I don't have SSL certificate but I didn't last week and it was not a problem.
Do you know anything about this error message ?
Edit
I tried with Opera, proxyError comes at a different step : https://www.sandbox.paypal.com/webapps/checkout/webflow/sparta/expresscheckoutvalidatedataflow?execution=e1s4
And once this morning on Firefox I had another Proxy Error after the first redirection :
Proxy Error
The proxy server received an invalid response from an upstream server.
The proxy server could not handle the request GET /webapps/checkout/webflow/sparta/expresscheckoutvalidatedataflow.
Reason: Error reading from remote server
I don't have the Proxy Error anymore since yesterday. I didn't change anything so it seems PayPal servers are unstable...
I'm having the same issue since Sunday evening (sorry that I can't post this as a comment, don't have enough reputation yet).
I'm on LiquidWeb shared hosting, using the Merchant SDK ( https://github.com/paypal/merchant-sdk-php ). I was on merchant-sdk-php-2.1.96 when the errors began, and tried upgrading to merchant-sdk-php-2.2.98 but now it is worse (won't even do the first redirect, which is confusing). My code is server side, but getting the timeout and proxy error at the same urls:
$setECResponse = $PayPal_service->SetExpressCheckout($setECReq);
if($setECResponse->Ack == 'Success') {
$token = $setECResponse->Token;
$payPalURL = 'https://www.sandbox.paypal.com/incontext?token=' . $token;
$this->Redirect($payPalURL);
}